box-ui-elements 15.0.0-beta.7 → 15.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/CONTRIBUTING.md +3 -1
- package/dist/explorer.css +1 -1
- package/dist/explorer.js +58 -26
- package/dist/openwith.css +1 -1
- package/dist/openwith.js +10 -17
- package/dist/picker.css +1 -1
- package/dist/picker.js +12 -19
- package/dist/preview.css +1 -1
- package/dist/preview.js +56 -24
- package/dist/sharing.css +1 -1
- package/dist/sharing.js +54 -22
- package/dist/sidebar.css +1 -1
- package/dist/sidebar.js +56 -24
- package/dist/uploader.css +1 -1
- package/dist/uploader.js +12 -19
- package/es/api/uploads/UploadsReachability.js.flow +2 -2
- package/es/api/uploads/UploadsReachability.js.map +1 -1
- package/es/common/messages.js +4 -0
- package/es/common/messages.js.flow +5 -0
- package/es/common/messages.js.map +1 -1
- package/es/common/types/core.js.flow +2 -0
- package/es/common/types/core.js.map +1 -1
- package/es/components/avatar/UnknownUserAvatar.js +6 -9
- package/es/components/avatar/UnknownUserAvatar.js.map +1 -1
- package/es/components/close-button/CloseButton.js +24 -0
- package/es/components/close-button/CloseButton.js.flow +26 -0
- package/es/components/close-button/CloseButton.js.map +1 -0
- package/es/components/close-button/CloseButton.scss +10 -0
- package/es/components/close-button/CloseButton.stories.js +14 -0
- package/es/components/close-button/CloseButton.stories.js.map +1 -0
- package/es/components/close-button/index.js +2 -0
- package/es/components/close-button/index.js.flow +2 -0
- package/es/components/close-button/index.js.map +1 -0
- package/es/components/date-picker/AccessiblePikaday.js +113 -0
- package/es/components/date-picker/AccessiblePikaday.js.map +1 -0
- package/es/components/date-picker/DatePicker.js +426 -106
- package/es/components/date-picker/DatePicker.js.map +1 -1
- package/es/components/date-picker/DatePicker.scss +32 -22
- package/es/components/date-picker/DatePicker.stories.js +10 -0
- package/es/components/date-picker/DatePicker.stories.js.map +1 -1
- package/es/components/date-picker/_pikaday.scss +8 -2
- package/es/components/flyout/Flyout.js +13 -3
- package/es/components/flyout/Flyout.js.flow +14 -3
- package/es/components/flyout/Flyout.js.map +1 -1
- package/es/components/flyout/Flyout.scss +40 -0
- package/es/components/flyout/FlyoutContext.js +6 -0
- package/es/components/flyout/FlyoutContext.js.flow +9 -0
- package/es/components/flyout/FlyoutContext.js.map +1 -0
- package/es/components/flyout/OverlayHeader.js +33 -0
- package/es/components/flyout/OverlayHeader.js.map +1 -0
- package/es/components/flyout/OverlayHeader.scss +9 -0
- package/es/components/flyout/_variables.scss +1 -0
- package/es/components/flyout/index.js +2 -0
- package/es/components/flyout/index.js.flow +2 -0
- package/es/components/flyout/index.js.map +1 -1
- package/es/components/image-tooltip/ImageTooltip.js +1 -2
- package/es/components/image-tooltip/ImageTooltip.js.map +1 -1
- package/es/components/media-query/constants.js +26 -0
- package/es/components/media-query/constants.js.flow +32 -0
- package/es/components/media-query/constants.js.map +1 -0
- package/es/components/media-query/index.js +3 -0
- package/es/components/media-query/index.js.flow +4 -0
- package/es/components/media-query/index.js.map +1 -0
- package/es/components/media-query/stories/MediaQuery.stories.js +37 -0
- package/es/components/media-query/stories/MediaQuery.stories.js.flow +80 -0
- package/es/components/media-query/stories/MediaQuery.stories.js.map +1 -0
- package/es/components/media-query/types.js +2 -0
- package/es/components/media-query/types.js.flow +29 -0
- package/es/components/media-query/types.js.map +1 -0
- package/es/components/media-query/useMediaQuery.js +91 -0
- package/es/components/media-query/useMediaQuery.js.flow +97 -0
- package/es/components/media-query/useMediaQuery.js.map +1 -0
- package/es/components/media-query/withMediaQuery.js +21 -0
- package/es/components/media-query/withMediaQuery.js.flow +23 -0
- package/es/components/media-query/withMediaQuery.js.map +1 -0
- package/es/components/modal/Modal.scss +27 -0
- package/es/components/preview/previewIcons.js +4 -0
- package/es/components/preview/previewIcons.js.map +1 -1
- package/es/components/search-form/SearchForm.scss +0 -5
- package/es/components/selector-dropdown/SelectorDropdown.js +5 -3
- package/es/components/selector-dropdown/SelectorDropdown.js.flow +3 -3
- package/es/components/selector-dropdown/SelectorDropdown.js.map +1 -1
- package/es/components/tab-view/Tabs.scss +0 -4
- package/es/components/tooltip/Tooltip.js +21 -4
- package/es/components/tooltip/Tooltip.js.map +1 -1
- package/es/constants.js +1 -0
- package/es/constants.js.flow +1 -0
- package/es/constants.js.map +1 -1
- package/es/elements/content-open-with/IconFileMap.js +0 -2
- package/es/elements/content-open-with/IconFileMap.js.flow +0 -2
- package/es/elements/content-open-with/IconFileMap.js.map +1 -1
- package/es/elements/content-sidebar/Sidebar.js +2 -1
- package/es/elements/content-sidebar/Sidebar.js.flow +1 -1
- package/es/elements/content-sidebar/Sidebar.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/common/delete-confirmation/DeleteConfirmation.scss +3 -3
- package/es/elements/content-sidebar/activity-feed/task-form/TaskForm.js +14 -4
- package/es/elements/content-sidebar/activity-feed/task-form/TaskForm.js.flow +18 -5
- package/es/elements/content-sidebar/activity-feed/task-form/TaskForm.js.map +1 -1
- package/es/elements/content-sidebar/versions/StaticVersionSidebar.js +78 -0
- package/es/elements/content-sidebar/versions/StaticVersionSidebar.js.flow +97 -0
- package/es/elements/content-sidebar/versions/StaticVersionSidebar.js.map +1 -0
- package/es/elements/content-sidebar/versions/StaticVersionsSidebar.scss +67 -0
- package/es/elements/content-sidebar/versions/VersionsSidebar.js +12 -4
- package/es/elements/content-sidebar/versions/VersionsSidebar.js.flow +16 -3
- package/es/elements/content-sidebar/versions/VersionsSidebar.js.map +1 -1
- package/es/elements/content-sidebar/versions/VersionsSidebar.scss +5 -0
- package/es/elements/content-sidebar/versions/VersionsSidebarContainer.js +42 -10
- package/es/elements/content-sidebar/versions/VersionsSidebarContainer.js.flow +42 -7
- package/es/elements/content-sidebar/versions/VersionsSidebarContainer.js.map +1 -1
- package/es/elements/content-sidebar/versions/flowTypes.js.flow +1 -0
- package/es/elements/content-sidebar/versions/messages.js +20 -0
- package/es/elements/content-sidebar/versions/messages.js.flow +28 -0
- package/es/elements/content-sidebar/versions/messages.js.map +1 -1
- package/es/features/classification/constants.js +2 -1
- package/es/features/classification/constants.js.flow +2 -0
- package/es/features/classification/constants.js.map +1 -1
- package/es/features/classification/flowTypes.js +1 -0
- package/es/features/classification/flowTypes.js.flow +7 -1
- package/es/features/classification/flowTypes.js.map +1 -1
- package/es/features/classification/security-controls/SecurityControls.js +3 -4
- package/es/features/classification/security-controls/SecurityControls.js.flow +3 -4
- package/es/features/classification/security-controls/SecurityControls.js.map +1 -1
- package/es/features/classification/security-controls/SecurityControlsItem.js +1 -1
- package/es/features/classification/security-controls/SecurityControlsItem.js.flow +20 -17
- package/es/features/classification/security-controls/SecurityControlsItem.js.map +1 -1
- package/es/features/classification/security-controls/SecurityControlsItem.scss +4 -0
- package/es/features/classification/security-controls/SecurityControlsModal.js +2 -2
- package/es/features/classification/security-controls/SecurityControlsModal.js.flow +2 -2
- package/es/features/classification/security-controls/SecurityControlsModal.js.map +1 -1
- package/es/features/classification/security-controls/messages.js +4 -0
- package/es/features/classification/security-controls/messages.js.flow +5 -0
- package/es/features/classification/security-controls/messages.js.map +1 -1
- package/es/features/classification/security-controls/utils.js +56 -35
- package/es/features/classification/security-controls/utils.js.flow +51 -27
- package/es/features/classification/security-controls/utils.js.map +1 -1
- package/es/features/collapsible-sidebar/CollapsibleSidebar.js +9 -3
- package/es/features/collapsible-sidebar/CollapsibleSidebar.js.flow +13 -5
- package/es/features/collapsible-sidebar/CollapsibleSidebar.js.map +1 -1
- package/es/features/collapsible-sidebar/CollapsibleSidebar.scss +35 -3
- package/es/features/content-explorer/content-explorer/ContentExplorer.scss +1 -1
- package/es/features/content-explorer/item-list/ItemList.js +1 -0
- package/es/features/content-explorer/item-list/ItemList.js.flow +1 -0
- package/es/features/content-explorer/item-list/ItemList.js.map +1 -1
- package/es/features/content-explorer/item-list/ItemListName.js +13 -2
- package/es/features/content-explorer/item-list/ItemListName.js.flow +3 -2
- package/es/features/content-explorer/item-list/ItemListName.js.map +1 -1
- package/es/features/header-flyout/HeaderFlyout.js +8 -10
- package/es/features/header-flyout/HeaderFlyout.js.flow +4 -8
- package/es/features/header-flyout/HeaderFlyout.js.map +1 -1
- package/es/features/header-flyout/styles/HeaderFlyout.scss +54 -15
- package/es/features/header-flyout/styles/_variables.scss +4 -0
- package/es/features/message-center/components/message-center-modal/MessageCenterModal.js +1 -0
- package/es/features/message-center/components/message-center-modal/MessageCenterModal.js.flow +1 -0
- package/es/features/message-center/components/message-center-modal/MessageCenterModal.js.map +1 -1
- package/es/features/presence/PresenceCollaborator.js +90 -0
- package/es/features/presence/PresenceCollaborator.js.flow +81 -0
- package/es/features/presence/PresenceCollaborator.js.map +1 -0
- package/es/features/presence/PresenceCollaborator.scss +28 -0
- package/es/features/presence/PresenceCollaboratorsList.js +9 -57
- package/es/features/presence/PresenceCollaboratorsList.js.flow +7 -58
- package/es/features/presence/PresenceCollaboratorsList.js.map +1 -1
- package/es/features/presence/PresenceCollaboratorsList.scss +8 -35
- package/es/features/quick-search/QuickSearch.js +4 -2
- package/es/features/quick-search/QuickSearch.js.flow +13 -1
- package/es/features/quick-search/QuickSearch.js.map +1 -1
- package/es/features/unified-share-modal/SharedLinkSection.js +9 -20
- package/es/features/unified-share-modal/SharedLinkSection.js.flow +6 -27
- package/es/features/unified-share-modal/SharedLinkSection.js.map +1 -1
- package/es/features/unified-share-modal/UnifiedShareForm.js +95 -53
- package/es/features/unified-share-modal/UnifiedShareForm.js.flow +70 -14
- package/es/features/unified-share-modal/UnifiedShareForm.js.map +1 -1
- package/es/features/unified-share-modal/UnifiedShareModal.scss +3 -0
- package/es/features/unified-share-modal/flowTypes.js.flow +6 -0
- package/es/features/unified-share-modal/flowTypes.js.map +1 -1
- package/es/features/unified-share-modal/messages.js +8 -0
- package/es/features/unified-share-modal/messages.js.flow +10 -0
- package/es/features/unified-share-modal/messages.js.map +1 -1
- package/es/features/unified-share-modal/utils/mergeContacts.js +13 -10
- package/es/features/unified-share-modal/utils/mergeContacts.js.flow +4 -2
- package/es/features/unified-share-modal/utils/mergeContacts.js.map +1 -1
- package/es/icon/content/FileXbd32.js +39 -0
- package/es/icon/content/FileXbd32.js.flow +38 -0
- package/es/icon/content/FileXbd32.js.map +1 -0
- package/es/icon/content/FileXbd32.stories.js +13 -0
- package/es/icon/content/FileXbd32.stories.js.map +1 -0
- package/es/icon/content/FileXdw32.js +39 -0
- package/es/icon/content/FileXdw32.js.flow +38 -0
- package/es/icon/content/FileXdw32.js.map +1 -0
- package/es/icon/content/FileXdw32.stories.js +13 -0
- package/es/icon/content/FileXdw32.stories.js.map +1 -0
- package/es/icon/content/RetentionPolicyModifiable32.js +36 -0
- package/es/icon/content/RetentionPolicyModifiable32.js.flow +31 -0
- package/es/icon/content/RetentionPolicyModifiable32.js.map +1 -0
- package/es/icon/content/RetentionPolicyModifiable32.stories.js +13 -0
- package/es/icon/content/RetentionPolicyModifiable32.stories.js.map +1 -0
- package/es/icon/content/RetentionPolicyNonModifiable32.js +36 -0
- package/es/icon/content/RetentionPolicyNonModifiable32.js.flow +31 -0
- package/es/icon/content/RetentionPolicyNonModifiable32.js.map +1 -0
- package/es/icon/content/RetentionPolicyNonModifiable32.stories.js +13 -0
- package/es/icon/content/RetentionPolicyNonModifiable32.stories.js.map +1 -0
- package/es/icons/avatars/UnknownUserAvatar.js +10 -34
- package/es/icons/avatars/UnknownUserAvatar.js.map +1 -1
- package/es/icons/file-icon/FileIcon.js +8 -2
- package/es/icons/file-icon/FileIcon.js.flow +2 -2
- package/es/icons/file-icon/FileIcon.js.map +1 -1
- package/es/icons/general/IconSearch.js +1 -1
- package/es/icons/general/IconSearch.js.flow +1 -1
- package/es/icons/general/IconSearch.js.map +1 -1
- package/es/icons/general/IconSearchJuicy.js +30 -0
- package/es/icons/general/IconSearchJuicy.js.flow +26 -0
- package/es/icons/general/IconSearchJuicy.js.map +1 -0
- package/es/icons/google-docs/IconGoogle.js +89 -0
- package/es/icons/google-docs/IconGoogle.js.flow +57 -0
- package/es/icons/google-docs/IconGoogle.js.map +1 -0
- package/es/icons/item-icon/ItemIcon.js +4 -0
- package/es/icons/item-icon/ItemIcon.js.map +1 -1
- package/es/icons/microsoft-office/IconOffice.js +80 -0
- package/es/icons/microsoft-office/IconOffice.js.flow +45 -0
- package/es/icons/microsoft-office/IconOffice.js.map +1 -0
- package/es/illustration/EmailVerification140.js +111 -0
- package/es/illustration/EmailVerification140.js.flow +102 -0
- package/es/illustration/EmailVerification140.js.map +1 -0
- package/es/illustration/EmailVerification140.stories.js +13 -0
- package/es/illustration/EmailVerification140.stories.js.map +1 -0
- package/es/src/components/close-button/CloseButton.d.ts +9 -0
- package/es/src/components/close-button/CloseButton.stories.d.ts +9 -0
- package/es/src/components/close-button/__tests__/CloseButton.stories.test.d.ts +0 -0
- package/es/src/components/close-button/__tests__/CloseButton.test.d.ts +1 -0
- package/es/src/components/close-button/index.d.ts +1 -0
- package/es/src/components/date-picker/AccessiblePikaday.d.ts +16 -0
- package/es/src/components/date-picker/DatePicker.d.ts +33 -6
- package/es/src/components/date-picker/DatePicker.stories.d.ts +2 -1
- package/es/src/components/flyout/OverlayHeader.d.ts +10 -0
- package/es/src/components/tooltip/Tooltip.d.ts +4 -3
- package/es/src/icon/content/FileXbd32.d.ts +13 -0
- package/es/src/icon/content/FileXbd32.stories.d.ts +9 -0
- package/es/src/icon/content/FileXdw32.d.ts +13 -0
- package/es/src/icon/content/FileXdw32.stories.d.ts +9 -0
- package/es/src/icon/content/RetentionPolicyModifiable32.d.ts +13 -0
- package/es/src/icon/content/RetentionPolicyModifiable32.stories.d.ts +9 -0
- package/es/src/icon/content/RetentionPolicyNonModifiable32.d.ts +13 -0
- package/es/src/icon/content/RetentionPolicyNonModifiable32.stories.d.ts +9 -0
- package/es/src/icons/avatars/UnknownUserAvatar.d.ts +0 -1
- package/es/src/icons/general/IconSearchJuicy.d.ts +3 -0
- package/es/src/icons/general/__tests__/IconSearchJuicy.test.d.ts +1 -0
- package/es/src/icons/google-docs/IconGoogle.d.ts +12 -0
- package/es/src/icons/google-docs/__tests__/IconGoogle.test.d.ts +1 -0
- package/es/src/icons/item-icon/ItemIcon.d.ts +2 -0
- package/es/src/icons/microsoft-office/IconOffice.d.ts +12 -0
- package/es/src/icons/microsoft-office/__tests__/IconOffice.test.d.ts +1 -0
- package/es/src/illustration/EmailVerification140.d.ts +13 -0
- package/es/src/illustration/EmailVerification140.stories.d.ts +9 -0
- package/es/src/styles/variables.d.ts +9 -0
- package/es/styles/_variables.scss +1 -0
- package/es/styles/common/_forms.scss +6 -0
- package/es/styles/constants/_layout.scss +3 -0
- package/es/styles/constants/_media-queries.scss +15 -0
- package/es/styles/variables.js +18 -0
- package/es/styles/variables.js.flow +10 -1
- package/es/styles/variables.js.map +1 -1
- package/es/utils/Browser.js +12 -0
- package/es/utils/Browser.js.flow +10 -0
- package/es/utils/Browser.js.map +1 -1
- package/es/utils/validators.js +26 -4
- package/es/utils/validators.js.flow +25 -3
- package/es/utils/validators.js.map +1 -1
- package/i18n/bn-IN.js +12 -0
- package/i18n/bn-IN.properties +24 -0
- package/i18n/da-DK.js +12 -0
- package/i18n/da-DK.properties +24 -0
- package/i18n/de-DE.js +12 -0
- package/i18n/de-DE.properties +24 -0
- package/i18n/en-AU.js +12 -0
- package/i18n/en-AU.properties +24 -0
- package/i18n/en-CA.js +12 -0
- package/i18n/en-CA.properties +24 -0
- package/i18n/en-GB.js +12 -0
- package/i18n/en-GB.properties +24 -0
- package/i18n/en-US.js +12 -0
- package/i18n/en-US.properties +24 -0
- package/i18n/en-x-pseudo.js +12 -0
- package/i18n/es-419.js +12 -0
- package/i18n/es-419.properties +24 -0
- package/i18n/es-ES.js +12 -0
- package/i18n/es-ES.properties +24 -0
- package/i18n/fi-FI.js +12 -0
- package/i18n/fi-FI.properties +24 -0
- package/i18n/fr-CA.js +12 -0
- package/i18n/fr-CA.properties +24 -0
- package/i18n/fr-FR.js +12 -0
- package/i18n/fr-FR.properties +24 -0
- package/i18n/hi-IN.js +12 -0
- package/i18n/hi-IN.properties +24 -0
- package/i18n/it-IT.js +12 -0
- package/i18n/it-IT.properties +24 -0
- package/i18n/ja-JP.js +25 -13
- package/i18n/ja-JP.properties +37 -13
- package/i18n/ko-KR.js +12 -0
- package/i18n/ko-KR.properties +24 -0
- package/i18n/nb-NO.js +12 -0
- package/i18n/nb-NO.properties +24 -0
- package/i18n/nl-NL.js +12 -0
- package/i18n/nl-NL.properties +24 -0
- package/i18n/pl-PL.js +12 -0
- package/i18n/pl-PL.properties +24 -0
- package/i18n/pt-BR.js +12 -0
- package/i18n/pt-BR.properties +24 -0
- package/i18n/ru-RU.js +12 -0
- package/i18n/ru-RU.properties +24 -0
- package/i18n/sv-SE.js +12 -0
- package/i18n/sv-SE.properties +24 -0
- package/i18n/tr-TR.js +12 -0
- package/i18n/tr-TR.properties +24 -0
- package/i18n/zh-CN.js +12 -0
- package/i18n/zh-CN.properties +24 -0
- package/i18n/zh-TW.js +12 -0
- package/i18n/zh-TW.properties +24 -0
- package/package.json +8 -5
- package/src/__mocks__/pikaday.js +1 -0
- package/src/api/__tests__/MockOpenWithData.json +2 -25
- package/src/api/uploads/UploadsReachability.js +2 -2
- package/src/common/messages.js +5 -0
- package/src/common/types/core.js +2 -0
- package/src/components/avatar/UnknownUserAvatar.tsx +5 -4
- package/src/components/close-button/CloseButton.js.flow +26 -0
- package/src/components/close-button/CloseButton.scss +10 -0
- package/src/components/close-button/CloseButton.stories.md +1 -0
- package/src/components/close-button/CloseButton.stories.tsx +14 -0
- package/src/components/close-button/CloseButton.tsx +30 -0
- package/src/components/close-button/__tests__/CloseButton.stories.test.tsx +6 -0
- package/src/components/close-button/__tests__/CloseButton.test.tsx +40 -0
- package/src/components/close-button/__tests__/__image_snapshots__/close-button-stories-test-tsx-components-close-button-close-button-looks-visually-correct-when-using-story-components-buttons-closebutton-regular-1-snap.png +0 -0
- package/src/components/close-button/index.js.flow +2 -0
- package/src/components/close-button/index.ts +1 -0
- package/src/components/date-picker/AccessiblePikaday.ts +79 -0
- package/src/components/date-picker/DatePicker.scss +32 -22
- package/src/components/date-picker/DatePicker.stories.tsx +6 -0
- package/src/components/date-picker/DatePicker.tsx +350 -64
- package/src/components/date-picker/__tests__/DatePicker.test.tsx +44 -2
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-allows-editing-in-story-components-datepicker-manually-editable-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-allows-keyboard-selection-in-components-datepicker-always-visible-with-custom-input-field-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-closes-calendar-and-clears-date-for-components-datepicker-basic-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-looks-visually-correct-when-using-story-components-datepicker-always-visible-with-custom-input-field-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-looks-visually-correct-when-using-story-components-datepicker-basic-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-looks-visually-correct-when-using-story-components-datepicker-custom-error-tooltip-position-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-looks-visually-correct-when-using-story-components-datepicker-disabled-with-error-message-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-looks-visually-correct-when-using-story-components-datepicker-manually-editable-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-looks-visually-correct-when-using-story-components-datepicker-with-description-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-looks-visually-correct-when-using-story-components-datepicker-with-limited-date-range-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-looks-visually-correct-when-using-story-components-datepicker-with-range-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-reflects-changes-in-components-datepicker-always-visible-with-custom-input-field-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-shows-calendar-and-date-for-components-datepicker-basic-1-snap.png +0 -0
- package/src/components/date-picker/__tests__/__image_snapshots__/date-picker-stories-test-tsx-components-date-picker-date-picker-shows-limited-range-in-components-datepicker-with-limited-date-range-1-snap.png +0 -0
- package/src/components/date-picker/_pikaday.scss +8 -2
- package/src/components/flyout/Flyout.js +14 -3
- package/src/components/flyout/Flyout.scss +40 -0
- package/src/components/flyout/FlyoutContext.js +9 -0
- package/src/components/flyout/OverlayHeader.scss +9 -0
- package/src/components/flyout/OverlayHeader.tsx +38 -0
- package/src/components/flyout/__tests__/Flyout.test.js +15 -0
- package/src/components/flyout/__tests__/OverlayHeader.test.js +56 -0
- package/src/components/flyout/_variables.scss +1 -0
- package/src/components/flyout/index.js +2 -0
- package/src/components/image-tooltip/ImageTooltip.tsx +1 -2
- package/src/components/media-query/__tests__/useMediaQuery.test.js +48 -0
- package/src/components/media-query/__tests__/withMediaQuery.test.js +29 -0
- package/src/components/media-query/constants.js +32 -0
- package/src/components/media-query/index.js +4 -0
- package/src/components/media-query/stories/MediaQuery.stories.js +80 -0
- package/src/components/media-query/stories/MediaQuery.stories.md +29 -0
- package/src/components/media-query/types.js +29 -0
- package/src/components/media-query/useMediaQuery.js +97 -0
- package/src/components/media-query/withMediaQuery.js +23 -0
- package/src/components/modal/Modal.scss +27 -0
- package/src/components/modal/__tests__/Modal.stories.test.js +10 -0
- package/src/components/modal/__tests__/__image_snapshots__/modal-stories-test-js-components-modal-modal-looks-visually-correct-for-small-screens-when-button-is-clicked-in-story-components-modal-basic-1-snap.png +0 -0
- package/src/components/modal/__tests__/__image_snapshots__/modal-stories-test-js-components-modal-modal-looks-visually-correct-for-small-screens-when-button-is-clicked-in-story-components-modal-with-custom-backdrop-click-handler-1-snap.png +0 -0
- package/src/components/preview/previewIcons.ts +4 -0
- package/src/components/search-form/SearchForm.scss +0 -5
- package/src/components/selector-dropdown/SelectorDropdown.js +3 -3
- package/src/components/selector-dropdown/__tests__/SelectorDropdown.test.js +5 -1
- package/src/components/sidebar-toggle-button/__tests__/__snapshots__/SidebarToggleButton.test.js.snap +0 -8
- package/src/components/tab-view/Tabs.scss +0 -4
- package/src/components/tooltip/Tooltip.tsx +20 -5
- package/src/components/tooltip/__tests__/Tooltip.test.tsx +17 -4
- package/src/components/tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +0 -2
- package/src/constants.js +1 -0
- package/src/elements/content-open-with/IconFileMap.js +0 -2
- package/src/elements/content-open-with/__tests__/ContentOpenWith.test.js +13 -13
- package/src/elements/content-open-with/__tests__/OpenWithButton.test.js +1 -1
- package/src/elements/content-open-with/__tests__/OpenWithDropdownMenu.test.js +1 -5
- package/src/elements/content-open-with/__tests__/OpenWithDropdownMenuItem.test.js +2 -2
- package/src/elements/content-open-with/__tests__/__snapshots__/ContentOpenWith.test.js.snap +5 -5
- package/src/elements/content-open-with/__tests__/__snapshots__/OpenWithButton.test.js.snap +1 -1
- package/src/elements/content-open-with/__tests__/__snapshots__/OpenWithDropdownMenu.test.js.snap +1 -11
- package/src/elements/content-open-with/__tests__/__snapshots__/OpenWithDropdownMenuItem.test.js.snap +4 -3
- package/src/elements/content-sidebar/Sidebar.js +1 -1
- package/src/elements/content-sidebar/__tests__/AddTaskButton.test.js +15 -0
- package/src/elements/content-sidebar/activity-feed/common/delete-confirmation/DeleteConfirmation.scss +3 -3
- package/src/elements/content-sidebar/activity-feed/task-form/TaskForm.js +18 -5
- package/src/elements/content-sidebar/versions/StaticVersionSidebar.js +97 -0
- package/src/elements/content-sidebar/versions/StaticVersionsSidebar.scss +67 -0
- package/src/elements/content-sidebar/versions/VersionsSidebar.js +16 -3
- package/src/elements/content-sidebar/versions/VersionsSidebar.scss +5 -0
- package/src/elements/content-sidebar/versions/VersionsSidebarContainer.js +42 -7
- package/src/elements/content-sidebar/versions/__tests__/VersionsSidebar.test.js +18 -1
- package/src/elements/content-sidebar/versions/__tests__/VersionsSidebarContainer.test.js +51 -2
- package/src/elements/content-sidebar/versions/__tests__/__snapshots__/VersionsSidebarContainer.test.js.snap +75 -0
- package/src/elements/content-sidebar/versions/flowTypes.js +1 -0
- package/src/elements/content-sidebar/versions/messages.js +28 -0
- package/src/features/classification/constants.js +2 -0
- package/src/features/classification/flowTypes.js +7 -1
- package/src/features/classification/security-controls/SecurityControls.js +3 -4
- package/src/features/classification/security-controls/SecurityControlsItem.js +20 -17
- package/src/features/classification/security-controls/SecurityControlsItem.scss +4 -0
- package/src/features/classification/security-controls/SecurityControlsModal.js +2 -2
- package/src/features/classification/security-controls/__tests__/SecurityControlsItem.test.js +10 -0
- package/src/features/classification/security-controls/__tests__/__snapshots__/SecurityControls.test.js.snap +6 -6
- package/src/features/classification/security-controls/__tests__/__snapshots__/SecurityControlsItem.test.js.snap +35 -0
- package/src/features/classification/security-controls/__tests__/__snapshots__/SecurityControlsModal.test.js.snap +2 -2
- package/src/features/classification/security-controls/__tests__/__snapshots__/utils.test.js.snap +20 -0
- package/src/features/classification/security-controls/__tests__/utils.test.js +38 -18
- package/src/features/classification/security-controls/messages.js +5 -0
- package/src/features/classification/security-controls/utils.js +51 -27
- package/src/features/collapsible-sidebar/CollapsibleSidebar.js +13 -5
- package/src/features/collapsible-sidebar/CollapsibleSidebar.scss +35 -3
- package/src/features/collapsible-sidebar/__tests__/CollapsibleSidebar.test.js +35 -0
- package/src/features/collapsible-sidebar/__tests__/__snapshots__/CollapsibleSidebar.test.js.snap +1 -0
- package/src/features/content-explorer/content-explorer/ContentExplorer.scss +1 -1
- package/src/features/content-explorer/item-list/ItemList.js +1 -0
- package/src/features/content-explorer/item-list/ItemListName.js +3 -2
- package/src/features/content-explorer/item-list/__tests__/ItemListName.test.js +16 -2
- package/src/features/header-flyout/HeaderFlyout.js +4 -8
- package/src/features/header-flyout/__tests__/__snapshots__/HeaderFlyout.test.js.snap +14 -11
- package/src/features/header-flyout/styles/HeaderFlyout.scss +54 -15
- package/src/features/header-flyout/styles/_variables.scss +4 -0
- package/src/features/message-center/components/message-center-modal/MessageCenterModal.js +1 -0
- package/src/features/metadata-instance-editor/__tests__/__snapshots__/TemplateDropdown.test.js.snap +7 -0
- package/src/features/pagination/__tests__/__snapshots__/MarkerBasedPagination.test.js.snap +0 -8
- package/src/features/pagination/__tests__/__snapshots__/OffsetBasedPagination.test.js.snap +0 -16
- package/src/features/presence/PresenceCollaborator.js +81 -0
- package/src/features/presence/PresenceCollaborator.scss +28 -0
- package/src/features/presence/PresenceCollaboratorsList.js +7 -58
- package/src/features/presence/PresenceCollaboratorsList.scss +8 -35
- package/src/features/presence/__tests__/PresenceCollaborator.test.js +36 -0
- package/src/features/presence/__tests__/PresenceCollaboratorsList.test.js +13 -57
- package/src/features/presence/__tests__/__snapshots__/Presence.test.js.snap +5 -0
- package/src/features/presence/__tests__/__snapshots__/PresenceLink.test.js.snap +3 -0
- package/src/features/query-bar/__tests__/__snapshots__/ColumnButton.test.js.snap +3 -0
- package/src/features/quick-search/QuickSearch.js +13 -1
- package/src/features/quick-search/__tests__/QuickSearch.test.js +17 -0
- package/src/features/unified-share-modal/SharedLinkSection.js +6 -27
- package/src/features/unified-share-modal/UnifiedShareForm.js +70 -14
- package/src/features/unified-share-modal/UnifiedShareModal.scss +3 -0
- package/src/features/unified-share-modal/__tests__/EmailForm.test.js +9 -0
- package/src/features/unified-share-modal/__tests__/SharedLinkSection.test.js +14 -4
- package/src/features/unified-share-modal/__tests__/UnifiedShareForm.test.js +53 -4
- package/src/features/unified-share-modal/__tests__/__snapshots__/SharedLinkSection.test.js.snap +9 -0
- package/src/features/unified-share-modal/__tests__/__snapshots__/UnifiedShareForm.test.js.snap +0 -159
- package/src/features/unified-share-modal/flowTypes.js +6 -0
- package/src/features/unified-share-modal/messages.js +10 -0
- package/src/features/unified-share-modal/utils/__tests__/mergeContacts.test.js +23 -0
- package/src/features/unified-share-modal/utils/mergeContacts.js +4 -2
- package/src/icon/content/FileXbd32.js.flow +38 -0
- package/src/icon/content/FileXbd32.stories.tsx +13 -0
- package/src/icon/content/FileXbd32.tsx +37 -0
- package/src/icon/content/FileXdw32.js.flow +38 -0
- package/src/icon/content/FileXdw32.stories.tsx +13 -0
- package/src/icon/content/FileXdw32.tsx +37 -0
- package/src/icon/content/RetentionPolicyModifiable32.js.flow +31 -0
- package/src/icon/content/RetentionPolicyModifiable32.stories.tsx +14 -0
- package/src/icon/content/RetentionPolicyModifiable32.tsx +29 -0
- package/src/icon/content/RetentionPolicyNonModifiable32.js.flow +31 -0
- package/src/icon/content/RetentionPolicyNonModifiable32.stories.tsx +14 -0
- package/src/icon/content/RetentionPolicyNonModifiable32.tsx +29 -0
- package/src/icons/adobe-sign/README.md +1 -1
- package/src/icons/avatars/UnknownUserAvatar.tsx +7 -15
- package/src/icons/file-icon/FileIcon.js.flow +2 -2
- package/src/icons/file-icon/FileIcon.tsx +8 -2
- package/src/icons/file-icon/__tests__/FileIcon.test.tsx +28 -69
- package/src/icons/file-icon/__tests__/__snapshots__/FileIcon.test.tsx.snap +48 -34
- package/src/icons/general/IconSearch.js.flow +1 -1
- package/src/icons/general/IconSearch.tsx +1 -1
- package/src/icons/general/IconSearchJuicy.js.flow +26 -0
- package/src/icons/general/IconSearchJuicy.tsx +25 -0
- package/src/icons/general/README.md +5 -0
- package/src/icons/general/__tests__/IconSearchJuicy.test.tsx +38 -0
- package/src/icons/google-docs/IconGoogle.js.flow +57 -0
- package/src/icons/google-docs/IconGoogle.tsx +50 -0
- package/src/icons/google-docs/__tests__/IconGoogle.test.tsx +44 -0
- package/src/icons/item-icon/ItemIcon.tsx +4 -0
- package/src/icons/item-icon/__tests__/ItemIcon.test.tsx +47 -115
- package/src/icons/item-icon/__tests__/__snapshots__/ItemIcon.test.tsx.snap +229 -229
- package/src/icons/microsoft-office/IconOffice.js.flow +45 -0
- package/src/icons/microsoft-office/IconOffice.tsx +38 -0
- package/src/icons/microsoft-office/__tests__/IconOffice.test.tsx +44 -0
- package/src/illustration/EmailVerification140.js.flow +102 -0
- package/src/illustration/EmailVerification140.stories.tsx +13 -0
- package/src/illustration/EmailVerification140.tsx +100 -0
- package/src/styles/_variables.scss +1 -0
- package/src/styles/common/_forms.scss +6 -0
- package/src/styles/constants/_layout.scss +3 -0
- package/src/styles/constants/_media-queries.scss +15 -0
- package/src/styles/variables.js +10 -1
- package/src/styles/variables.json +10 -1
- package/src/styles/variables.ts +9 -0
- package/src/utils/Browser.js +10 -0
- package/src/utils/validators.js +25 -3
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
import { toQuery, useMediaQuery as _useMediaQuery } from 'react-responsive';
|
|
8
|
+
import { ANY_HOVER, ANY_POINTER_COARSE, ANY_POINTER_FINE, HOVER, HOVER_TYPE, POINTER_COARSE, POINTER_FINE, POINTER_TYPE, SIZE_LARGE, SIZE_MEDIUM, SIZE_SMALL, VIEW_SIZE_TYPE } from './constants';
|
|
9
|
+
|
|
10
|
+
var getPointerCapabilities = function getPointerCapabilities(isFine, isCoarse) {
|
|
11
|
+
if (!isFine && !isCoarse) return POINTER_TYPE.none;
|
|
12
|
+
if (isFine) return POINTER_TYPE.fine;
|
|
13
|
+
return POINTER_TYPE.coarse;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
var getViewDimensions = function getViewDimensions() {
|
|
17
|
+
return {
|
|
18
|
+
viewWidth: window.innerWidth,
|
|
19
|
+
viewHeight: window.innerHeight
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Formats the media query either as a MediaQuery object or string
|
|
24
|
+
* @param query
|
|
25
|
+
* @returns {string}
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
function formatQuery(query) {
|
|
30
|
+
return typeof query === 'string' ? query : toQuery(query);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Executes media query
|
|
34
|
+
* @param query
|
|
35
|
+
* @param onQueryChange
|
|
36
|
+
* @returns {boolean}
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
function useQuery(query, onQueryChange) {
|
|
41
|
+
return _useMediaQuery({
|
|
42
|
+
query: formatQuery(query)
|
|
43
|
+
}, null, onQueryChange);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Determines device capabilities for hover and pointer features
|
|
47
|
+
* @returns {{anyPointer: *, hover: (string), pointer: *, anyHover: (string)}}
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
function useDeviceCapabilities() {
|
|
52
|
+
var isHover = useQuery(HOVER);
|
|
53
|
+
var isAnyHover = useQuery(ANY_HOVER);
|
|
54
|
+
var anyHover = isAnyHover ? HOVER_TYPE.hover : HOVER_TYPE.none;
|
|
55
|
+
var hover = isHover ? HOVER_TYPE.hover : HOVER_TYPE.none;
|
|
56
|
+
var pointer = getPointerCapabilities(useQuery(POINTER_FINE), useQuery(POINTER_COARSE));
|
|
57
|
+
var anyPointer = getPointerCapabilities(useQuery(ANY_POINTER_FINE), useQuery(ANY_POINTER_COARSE));
|
|
58
|
+
return {
|
|
59
|
+
anyHover: anyHover,
|
|
60
|
+
hover: hover,
|
|
61
|
+
anyPointer: anyPointer,
|
|
62
|
+
pointer: pointer
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Determines device size using media queries
|
|
67
|
+
* @returns {string}
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
function useDeviceSize() {
|
|
72
|
+
var isSmall = useQuery(SIZE_SMALL);
|
|
73
|
+
var isMedium = useQuery(SIZE_MEDIUM);
|
|
74
|
+
var isLarge = useQuery(SIZE_LARGE);
|
|
75
|
+
if (isSmall) return VIEW_SIZE_TYPE.small;
|
|
76
|
+
if (isMedium) return VIEW_SIZE_TYPE.medium;
|
|
77
|
+
if (isLarge) return VIEW_SIZE_TYPE.large;
|
|
78
|
+
return VIEW_SIZE_TYPE.xlarge;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function useMediaQuery() {
|
|
82
|
+
var deviceCapabilities = useDeviceCapabilities();
|
|
83
|
+
var deviceSize = useDeviceSize();
|
|
84
|
+
var viewDimensions = getViewDimensions();
|
|
85
|
+
return _objectSpread({}, deviceCapabilities, {}, viewDimensions, {
|
|
86
|
+
size: deviceSize
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default useMediaQuery;
|
|
91
|
+
//# sourceMappingURL=useMediaQuery.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import { toQuery, useMediaQuery as _useMediaQuery } from 'react-responsive';
|
|
4
|
+
import {
|
|
5
|
+
ANY_HOVER,
|
|
6
|
+
ANY_POINTER_COARSE,
|
|
7
|
+
ANY_POINTER_FINE,
|
|
8
|
+
HOVER,
|
|
9
|
+
HOVER_TYPE,
|
|
10
|
+
POINTER_COARSE,
|
|
11
|
+
POINTER_FINE,
|
|
12
|
+
POINTER_TYPE,
|
|
13
|
+
SIZE_LARGE,
|
|
14
|
+
SIZE_MEDIUM,
|
|
15
|
+
SIZE_SMALL,
|
|
16
|
+
VIEW_SIZE_TYPE,
|
|
17
|
+
} from './constants';
|
|
18
|
+
import type { MediaQuery, MediaShape } from './types';
|
|
19
|
+
|
|
20
|
+
const getPointerCapabilities = (isFine: boolean, isCoarse: boolean) => {
|
|
21
|
+
if (!isFine && !isCoarse) return POINTER_TYPE.none;
|
|
22
|
+
if (isFine) return POINTER_TYPE.fine;
|
|
23
|
+
return POINTER_TYPE.coarse;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getViewDimensions = () => {
|
|
27
|
+
return { viewWidth: window.innerWidth, viewHeight: window.innerHeight };
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Formats the media query either as a MediaQuery object or string
|
|
32
|
+
* @param query
|
|
33
|
+
* @returns {string}
|
|
34
|
+
*/
|
|
35
|
+
function formatQuery(query: MediaQuery): string {
|
|
36
|
+
return typeof query === 'string' ? query : toQuery(query);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Executes media query
|
|
41
|
+
* @param query
|
|
42
|
+
* @param onQueryChange
|
|
43
|
+
* @returns {boolean}
|
|
44
|
+
*/
|
|
45
|
+
function useQuery(query: MediaQuery, onQueryChange?: (_: boolean) => void): boolean {
|
|
46
|
+
return _useMediaQuery({ query: formatQuery(query) }, null, onQueryChange);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Determines device capabilities for hover and pointer features
|
|
51
|
+
* @returns {{anyPointer: *, hover: (string), pointer: *, anyHover: (string)}}
|
|
52
|
+
*/
|
|
53
|
+
function useDeviceCapabilities() {
|
|
54
|
+
const isHover: boolean = useQuery(HOVER);
|
|
55
|
+
const isAnyHover: boolean = useQuery(ANY_HOVER);
|
|
56
|
+
|
|
57
|
+
const anyHover = isAnyHover ? HOVER_TYPE.hover : HOVER_TYPE.none;
|
|
58
|
+
const hover = isHover ? HOVER_TYPE.hover : HOVER_TYPE.none;
|
|
59
|
+
const pointer = getPointerCapabilities(useQuery(POINTER_FINE), useQuery(POINTER_COARSE));
|
|
60
|
+
const anyPointer = getPointerCapabilities(useQuery(ANY_POINTER_FINE), useQuery(ANY_POINTER_COARSE));
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
anyHover,
|
|
64
|
+
hover,
|
|
65
|
+
anyPointer,
|
|
66
|
+
pointer,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Determines device size using media queries
|
|
72
|
+
* @returns {string}
|
|
73
|
+
*/
|
|
74
|
+
function useDeviceSize() {
|
|
75
|
+
const isSmall: boolean = useQuery(SIZE_SMALL);
|
|
76
|
+
const isMedium: boolean = useQuery(SIZE_MEDIUM);
|
|
77
|
+
const isLarge: boolean = useQuery(SIZE_LARGE);
|
|
78
|
+
|
|
79
|
+
if (isSmall) return VIEW_SIZE_TYPE.small;
|
|
80
|
+
if (isMedium) return VIEW_SIZE_TYPE.medium;
|
|
81
|
+
if (isLarge) return VIEW_SIZE_TYPE.large;
|
|
82
|
+
|
|
83
|
+
return VIEW_SIZE_TYPE.xlarge;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function useMediaQuery(): MediaShape {
|
|
87
|
+
const deviceCapabilities = useDeviceCapabilities();
|
|
88
|
+
const deviceSize = useDeviceSize();
|
|
89
|
+
const viewDimensions = getViewDimensions();
|
|
90
|
+
return {
|
|
91
|
+
...deviceCapabilities,
|
|
92
|
+
...viewDimensions,
|
|
93
|
+
size: deviceSize,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default useMediaQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/media-query/useMediaQuery.js"],"names":["toQuery","useMediaQuery","_useMediaQuery","ANY_HOVER","ANY_POINTER_COARSE","ANY_POINTER_FINE","HOVER","HOVER_TYPE","POINTER_COARSE","POINTER_FINE","POINTER_TYPE","SIZE_LARGE","SIZE_MEDIUM","SIZE_SMALL","VIEW_SIZE_TYPE","getPointerCapabilities","isFine","isCoarse","none","fine","coarse","getViewDimensions","viewWidth","window","innerWidth","viewHeight","innerHeight","formatQuery","query","useQuery","onQueryChange","useDeviceCapabilities","isHover","isAnyHover","anyHover","hover","pointer","anyPointer","useDeviceSize","isSmall","isMedium","isLarge","small","medium","large","xlarge","deviceCapabilities","deviceSize","viewDimensions","size"],"mappings":";;;;;;AAEA,SAASA,OAAT,EAAkBC,aAAa,IAAIC,cAAnC,QAAyD,kBAAzD;AACA,SACIC,SADJ,EAEIC,kBAFJ,EAGIC,gBAHJ,EAIIC,KAJJ,EAKIC,UALJ,EAMIC,cANJ,EAOIC,YAPJ,EAQIC,YARJ,EASIC,UATJ,EAUIC,WAVJ,EAWIC,UAXJ,EAYIC,cAZJ,QAaO,aAbP;;AAgBA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,MAAD,EAAkBC,QAAlB,EAAwC;AACnE,MAAI,CAACD,MAAD,IAAW,CAACC,QAAhB,EAA0B,OAAOP,YAAY,CAACQ,IAApB;AAC1B,MAAIF,MAAJ,EAAY,OAAON,YAAY,CAACS,IAApB;AACZ,SAAOT,YAAY,CAACU,MAApB;AACH,CAJD;;AAMA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,GAAM;AAC5B,SAAO;AAAEC,IAAAA,SAAS,EAAEC,MAAM,CAACC,UAApB;AAAgCC,IAAAA,UAAU,EAAEF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,WAAD,CAAlC;AACA,MAAM6B,OAAgB,GAAGZ,QAAQ,CAAClB,UAAD,CAAjC;AAEA,MAAI4B,OAAJ,EAAa,OAAOzB,cAAc,CAAC4B,KAAtB;AACb,MAAIF,QAAJ,EAAc,OAAO1B,cAAc,CAAC6B,MAAtB;AACd,MAAIF,OAAJ,EAAa,OAAO3B,cAAc,CAAC8B,KAAtB;AAEb,SAAO9B,cAAc,CAAC+B,MAAtB;AACH;;AAED,SAAS5C,aAAT,GAAqC;AACjC,MAAM6C,kBAAkB,GAAGf,qBAAqB,EAAhD;AACA,MAAMgB,UAAU,GAAGT,aAAa,EAAhC;AACA,MAAMU,cAAc,GAAG3B,iBAAiB,EAAxC;AACA,2BACOyB,kBADP,MAEOE,cAFP;AAGIC,IAAAA,IAAI,EAAEF;AAHV;AAKH;;AAED,eAAe9C,aAAf","sourcesContent":["// @flow\n\nimport { toQuery, useMediaQuery as _useMediaQuery } from 'react-responsive';\nimport {\n ANY_HOVER,\n ANY_POINTER_COARSE,\n ANY_POINTER_FINE,\n HOVER,\n HOVER_TYPE,\n POINTER_COARSE,\n POINTER_FINE,\n POINTER_TYPE,\n SIZE_LARGE,\n SIZE_MEDIUM,\n SIZE_SMALL,\n VIEW_SIZE_TYPE,\n} from './constants';\nimport type { MediaQuery, MediaShape } from './types';\n\nconst getPointerCapabilities = (isFine: boolean, isCoarse: boolean) => {\n if (!isFine && !isCoarse) return POINTER_TYPE.none;\n if (isFine) return POINTER_TYPE.fine;\n return POINTER_TYPE.coarse;\n};\n\nconst getViewDimensions = () => {\n return { viewWidth: window.innerWidth, viewHeight: window.innerHeight };\n};\n\n/**\n * Formats the media query either as a MediaQuery object or string\n * @param query\n * @returns {string}\n */\nfunction formatQuery(query: MediaQuery): string {\n return typeof query === 'string' ? query : toQuery(query);\n}\n\n/**\n * Executes media query\n * @param query\n * @param onQueryChange\n * @returns {boolean}\n */\nfunction useQuery(query: MediaQuery, onQueryChange?: (_: boolean) => void): boolean {\n return _useMediaQuery({ query: formatQuery(query) }, null, onQueryChange);\n}\n\n/**\n * Determines device capabilities for hover and pointer features\n * @returns {{anyPointer: *, hover: (string), pointer: *, anyHover: (string)}}\n */\nfunction useDeviceCapabilities() {\n const isHover: boolean = useQuery(HOVER);\n const isAnyHover: boolean = useQuery(ANY_HOVER);\n\n const anyHover = isAnyHover ? HOVER_TYPE.hover : HOVER_TYPE.none;\n const hover = isHover ? HOVER_TYPE.hover : HOVER_TYPE.none;\n const pointer = getPointerCapabilities(useQuery(POINTER_FINE), useQuery(POINTER_COARSE));\n const anyPointer = getPointerCapabilities(useQuery(ANY_POINTER_FINE), useQuery(ANY_POINTER_COARSE));\n\n return {\n anyHover,\n hover,\n anyPointer,\n pointer,\n };\n}\n\n/**\n * Determines device size using media queries\n * @returns {string}\n */\nfunction useDeviceSize() {\n const isSmall: boolean = useQuery(SIZE_SMALL);\n const isMedium: boolean = useQuery(SIZE_MEDIUM);\n const isLarge: boolean = useQuery(SIZE_LARGE);\n\n if (isSmall) return VIEW_SIZE_TYPE.small;\n if (isMedium) return VIEW_SIZE_TYPE.medium;\n if (isLarge) return VIEW_SIZE_TYPE.large;\n\n return VIEW_SIZE_TYPE.xlarge;\n}\n\nfunction useMediaQuery(): MediaShape {\n const deviceCapabilities = useDeviceCapabilities();\n const deviceSize = useDeviceSize();\n const viewDimensions = getViewDimensions();\n return {\n ...deviceCapabilities,\n ...viewDimensions,\n size: deviceSize,\n };\n}\n\nexport default useMediaQuery;\n"],"file":"useMediaQuery.js"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
|
|
5
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
+
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import useMediaQuery from './useMediaQuery';
|
|
9
|
+
|
|
10
|
+
function withMediaQuery(WrappedComponent) {
|
|
11
|
+
return function (_ref) {
|
|
12
|
+
var children = _ref.children,
|
|
13
|
+
rest = _objectWithoutProperties(_ref, ["children"]);
|
|
14
|
+
|
|
15
|
+
var mediaProps = useMediaQuery();
|
|
16
|
+
return React.createElement(WrappedComponent, _extends({}, rest, mediaProps), children);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default withMediaQuery;
|
|
21
|
+
//# sourceMappingURL=withMediaQuery.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import useMediaQuery from './useMediaQuery';
|
|
5
|
+
import type { MediaShape } from './types';
|
|
6
|
+
|
|
7
|
+
type PropsShape = {
|
|
8
|
+
children: React.Node,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function withMediaQuery<Props: PropsShape>(WrappedComponent: React.ComponentType<any>): React.ComponentType<any> {
|
|
12
|
+
return ({ children, ...rest }: Props) => {
|
|
13
|
+
const mediaProps: MediaShape = useMediaQuery();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<WrappedComponent {...rest} {...mediaProps}>
|
|
17
|
+
{children}
|
|
18
|
+
</WrappedComponent>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default withMediaQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/media-query/withMediaQuery.js"],"names":["React","useMediaQuery","withMediaQuery","WrappedComponent","children","rest","mediaProps"],"mappings":";;;;;;AAEA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;;AAOA,SAASC,cAAT,CAA2CC,gBAA3C,EAAiH;AAC7G,SAAO,gBAAkC;AAAA,QAA/BC,QAA+B,QAA/BA,QAA+B;AAAA,QAAlBC,IAAkB;;AACrC,QAAMC,UAAsB,GAAGL,aAAa,EAA5C;AAEA,WACI,oBAAC,gBAAD,eAAsBI,IAAtB,EAAgCC,UAAhC,GACKF,QADL,CADJ;AAKH,GARD;AASH;;AAED,eAAeF,cAAf","sourcesContent":["// @flow\n\nimport * as React from 'react';\nimport useMediaQuery from './useMediaQuery';\nimport type { MediaShape } from './types';\n\ntype PropsShape = {\n children: React.Node,\n};\n\nfunction withMediaQuery<Props: PropsShape>(WrappedComponent: React.ComponentType<any>): React.ComponentType<any> {\n return ({ children, ...rest }: Props) => {\n const mediaProps: MediaShape = useMediaQuery();\n\n return (\n <WrappedComponent {...rest} {...mediaProps}>\n {children}\n </WrappedComponent>\n );\n };\n}\n\nexport default withMediaQuery;\n"],"file":"withMediaQuery.js"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@import '../../styles/variables';
|
|
2
2
|
@import '../../styles/mixins/buttons';
|
|
3
|
+
@import '../../styles/constants/media-queries';
|
|
3
4
|
|
|
4
5
|
/**************************************
|
|
5
6
|
* Modal
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
display: flex;
|
|
57
58
|
flex-direction: column;
|
|
58
59
|
width: 460px;
|
|
60
|
+
max-width: 100%;
|
|
59
61
|
margin: auto;
|
|
60
62
|
padding: 30px;
|
|
61
63
|
background-color: $white;
|
|
@@ -133,3 +135,28 @@
|
|
|
133
135
|
z-index: 89;
|
|
134
136
|
display: flex;
|
|
135
137
|
}
|
|
138
|
+
|
|
139
|
+
//Responsive support - triggers fullscreen mode after reaching $small-medium-screen width
|
|
140
|
+
.is-responsive-web {
|
|
141
|
+
@include breakpoint($small-medium-screen) {
|
|
142
|
+
.modal {
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
padding: 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.modal-dialog {
|
|
148
|
+
min-height: 100%;
|
|
149
|
+
padding: 22px 16px 12px 16px;
|
|
150
|
+
border-radius: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.modal-close-button {
|
|
154
|
+
right: 10px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.modal-dialog-container {
|
|
159
|
+
flex-basis: 100%;
|
|
160
|
+
width: 100%;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -29,6 +29,8 @@ import IconFileThreeD from '../../icon/content/FileThreeD32';
|
|
|
29
29
|
import IconFileVector from '../../icon/content/FileVector32';
|
|
30
30
|
import IconFileVideo from '../../icon/content/FileVideo32';
|
|
31
31
|
import IconFileWord from '../../icon/content/FileWord32';
|
|
32
|
+
import IconFileXbd from '../../icon/content/FileXbd32';
|
|
33
|
+
import IconFileXdw from '../../icon/content/FileXdw32';
|
|
32
34
|
import IconFileZip from '../../icon/content/FileZip32';
|
|
33
35
|
var configs = {};
|
|
34
36
|
|
|
@@ -65,6 +67,8 @@ register(IconFileThreeD, '#F7931D', ['3ds', 'box3d', 'dae', 'fbx', 'obj', 'ply',
|
|
|
65
67
|
register(IconFileVector, '#F7931D', ['eps']);
|
|
66
68
|
register(IconFileVideo, '#009AED', ['3g2', '3gp', 'avi', 'flv', 'm2v', 'm2ts', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mts', 'ogg', 'qt', 'ts', 'wmv']);
|
|
67
69
|
register(IconFileWord, '#185ABD', ['doc', 'docx']);
|
|
70
|
+
register(IconFileXbd, '#00838D', ['xbd']);
|
|
71
|
+
register(IconFileXdw, '#00838D', ['xdw']);
|
|
68
72
|
register(IconFileZip, vars.bdlGray20, ['tgz', 'zip']);
|
|
69
73
|
export var getColor = function getColor(extension) {
|
|
70
74
|
return extension && configs[extension] ? configs[extension].color : vars.bdlBoxBlue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/preview/previewIcons.ts"],"names":["vars","IconFileAudio","IconFileBoxNote","IconFileCode","IconFileDefault","IconFileDwg","IconFileExcelSpreadsheet","IconFileGoogleDocs","IconFileGoogleSheets","IconFileGoogleSlides","IconFileIllustrator","IconFileImage","IconFileIndesign","IconFileKeynote","IconFileNumbers","IconFilePDF","IconFilePages","IconFilePhotoshop","IconFilePowerpoint","IconFilePresentation","IconFileSpreadsheet","IconFileText","IconFileThreeD","IconFileVector","IconFileVideo","IconFileWord","IconFileZip","configs","register","icon","color","extensions","forEach","extension","bdlPurpleRain","bdlGray20","bdlBoxBlue","getColor","getIcon"],"mappings":"AAAA;;;;;AAKA,OAAO,KAAKA,IAAZ,MAAsB,wBAAtB;AACA,OAAOC,aAAP,MAA0B,gCAA1B;AACA,OAAOC,eAAP,MAA4B,kCAA5B;AACA,OAAOC,YAAP,MAAyB,+BAAzB;AACA,OAAOC,eAAP,MAA4B,kCAA5B;AACA,OAAOC,WAAP,MAAwB,8BAAxB;AACA,OAAOC,wBAAP,MAAqC,gCAArC;AACA,OAAOC,kBAAP,MAA+B,+BAA/B;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AACA,OAAOC,mBAAP,MAAgC,sCAAhC;AACA,OAAOC,aAAP,MAA0B,gCAA1B;AACA,OAAOC,gBAAP,MAA6B,mCAA7B;AACA,OAAOC,eAAP,MAA4B,kCAA5B;AACA,OAAOC,eAAP,MAA4B,k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,cAAD,EAAiB,SAAjB,EAA4B,CAAC,KAAD,EAAQ,OAAR,EAAiB,KAAjB,EAAwB,KAAxB,EAA+B,KAA/B,EAAsC,KAAtC,EAA6C,KAA7C,CAA5B,CAAR;AACAM,QAAQ,CAACL,cAAD,EAAiB,SAAjB,EAA4B,CAAC,KAAD,CAA5B,CAAR;AACAK,QAAQ,CAACJ,aAAD,EAAgB,SAAhB,EAA2B,CAC/B,KAD+B,EAE/B,KAF+B,EAG/B,KAH+B,EAI/B,KAJ+B,EAK/B,KAL+B,EAM/B,MAN+B,EAO/B,KAP+B,EAQ/B,KAR+B,EAS/B,KAT+B,EAU/B,KAV+B,EAW/B,MAX+B,EAY/B,KAZ+B,EAa/B,KAb+B,EAc/B,KAd+B,EAe/B,IAf+B,EAgB/B,IAhB+B,EAiB/B,KAjB+B,CAA3B,CAAR;AAmBAI,QAAQ,CAACH,YAAD,EAAe,SAAf,EAA0B,CAAC,KAAD,EAAQ,MAAR,CAA1B,CAAR;AACAG,QAAQ,CAACF,WAAD,EAAc1B,IAAI,CAACmC,SAAnB,EAA8B,CAAC,KAAD,EAAQ,KAAR,CAA9B,CAAR;AAEA,OAAO,IAAME,QAAQ,GAAG,SAAXA,QAAW,CAACJ,SAAD,EAAyC;AAC7D,SAAOA,SAAS,IAAIN,OAAO,CAACM,SAAD,CAApB,GAAkCN,OAAO,CAACM,SAAD,CAAP,CAAmBH,KAArD,GAA6D9B,IAAI,CAACoC,UAAzE;AACH,CAFM;AAIP,OAAO,IAAME,OAAO,GAAG,SAAVA,OAAU,CAACL,SAAD,EAAwC;AAC3D,SAAOA,SAAS,IAAIN,OAAO,CAACM,SAAD,CAApB,GAAkCN,OAAO,CAACM,SAAD,CAAP,CAAmBJ,IAArD,GAA4DzB,eAAnE;AACH,CAFM","sourcesContent":["/**\n * Note: This map is intentionally kept separate from other icon maps, such as FileIcon. Preview only shows\n * file-specific loading icons for file types that can be previewed. Unsupported files show a default\n * icon, even if they have a relevant thumbnail/icon that is displayed within the item list, for example.\n */\nimport * as vars from '../../styles/variables';\nimport IconFileAudio from '../../icon/content/FileAudio32';\nimport IconFileBoxNote from '../../icon/content/FileBoxNote32';\nimport IconFileCode from '../../icon/content/FileCode32';\nimport IconFileDefault from '../../icon/content/FileDefault32';\nimport IconFileDwg from '../../icon/content/FileDwg32';\nimport IconFileExcelSpreadsheet from '../../icon/content/FileExcel32';\nimport IconFileGoogleDocs from '../../icon/content/FileDocs32';\nimport IconFileGoogleSheets from '../../icon/content/FileSheets32';\nimport IconFileGoogleSlides from '../../icon/content/FileSlides32';\nimport IconFileIllustrator from '../../icon/content/FileIllustrator32';\nimport IconFileImage from '../../icon/content/FileImage32';\nimport IconFileIndesign from '../../icon/content/FileIndesign32';\nimport IconFileKeynote from '../../icon/content/FileKeynote32';\nimport IconFileNumbers from '../../icon/content/FileNumbers32';\nimport IconFilePDF from '../../icon/content/FilePdf32';\nimport IconFilePages from '../../icon/content/FilePages32';\nimport IconFilePhotoshop from '../../icon/content/FilePhotoshop32';\nimport IconFilePowerpoint from '../../icon/content/FilePowerpoint32';\nimport IconFilePresentation from '../../icon/content/FilePresentation32';\nimport IconFileSpreadsheet from '../../icon/content/FileSpreadsheet32';\nimport IconFileText from '../../icon/content/FileText32';\nimport IconFileThreeD from '../../icon/content/FileThreeD32';\nimport IconFileVector from '../../icon/content/FileVector32';\nimport IconFileVideo from '../../icon/content/FileVideo32';\nimport IconFileWord from '../../icon/content/FileWord32';\nimport IconFileZip from '../../icon/content/FileZip32';\nimport { SVGProps } from '../accessible-svg/AccessibleSVG';\n\ntype Config = { color: string; icon: Icon };\ntype Configs = { [key: string]: Config }; // { docx: { color: '#333', icon: IconFileWord }\ntype Icon = (props: SVGProps) => JSX.Element;\n\nconst configs: Configs = {};\nconst register = (icon: Icon, color: string, extensions: string[]): void => {\n extensions.forEach(extension => {\n configs[extension] = { color, icon };\n });\n};\n\nregister(IconFileAudio, vars.bdlPurpleRain, [\n 'aac',\n 'aif',\n 'aifc',\n 'aiff',\n 'amr',\n 'au',\n 'flac',\n 'm4a',\n 'mp3',\n 'ra',\n 'wav',\n 'wma',\n]);\nregister(IconFileBoxNote, vars.bdlGray20, ['boxnote']);\nregister(IconFileCode, '#E33D55', [\n 'as',\n 'as3',\n 'asm',\n 'bat',\n 'c',\n 'cc',\n 'cmake',\n 'cpp',\n 'cs',\n 'css',\n 'cxx',\n 'diff',\n 'erb',\n 'groovy',\n 'h',\n 'haml',\n 'hh',\n 'htm',\n 'html',\n 'java',\n 'js',\n 'json',\n 'less',\n 'm',\n 'make',\n 'md',\n 'ml',\n 'mm',\n 'php',\n 'pl',\n 'plist',\n 'properties',\n 'py',\n 'rb',\n 'rst',\n 'sass',\n 'scala',\n 'script',\n 'scm',\n 'sml',\n 'sql',\n 'sh',\n 'vi',\n 'vim',\n 'xhtml',\n 'xml',\n 'xsd',\n 'xsl',\n 'yaml',\n]);\nregister(IconFileDwg, '#009AED', ['dwg']);\nregister(IconFileIllustrator, '#FF9400', ['ai']);\nregister(IconFileExcelSpreadsheet, '#107C41', ['xls', 'xlsm', 'xlsx', 'xlsb']);\nregister(IconFileGoogleDocs, '#4083F7', ['gdoc']);\nregister(IconFileGoogleSheets, '#21A464', ['gsheet']);\nregister(IconFileGoogleSlides, '#F7BA00', ['gslide', 'gslides']);\nregister(IconFileImage, '#3FB87F', [\n 'bmp',\n 'cr2',\n 'crw',\n 'dcm',\n 'dng',\n 'gif',\n 'heic',\n 'jpeg',\n 'jpg',\n 'nef',\n 'png',\n 'ps',\n 'raf',\n 'raw',\n 'svg',\n 'swf',\n 'tga',\n 'tif',\n 'tiff',\n]);\nregister(IconFileIndesign, '#FF57A1', ['idml', 'indd', 'indt', 'inx']);\nregister(IconFileKeynote, '#007AFF', ['key']);\nregister(IconFileNumbers, '#00A650', ['numbers']);\nregister(IconFilePDF, '#D0021B', ['pdf']);\nregister(IconFilePages, '#FF9500', ['pages']);\nregister(IconFilePhotoshop, '#26C9FF', ['psd']);\nregister(IconFilePowerpoint, '#C43E1C', ['ppt', 'pptx']);\nregister(IconFilePresentation, '#F7931D', ['odp']);\nregister(IconFileSpreadsheet, '#3FB87F', ['csv', 'tsv']);\nregister(IconFileText, vars.bdlBoxBlue, ['log', 'msg', 'ods', 'odt', 'rtf', 'txt', 'webdoc', 'wpd']);\nregister(IconFileThreeD, '#F7931D', ['3ds', 'box3d', 'dae', 'fbx', 'obj', 'ply', 'stl']);\nregister(IconFileVector, '#F7931D', ['eps']);\nregister(IconFileVideo, '#009AED', [\n '3g2',\n '3gp',\n 'avi',\n 'flv',\n 'm2v',\n 'm2ts',\n 'm4v',\n 'mkv',\n 'mov',\n 'mp4',\n 'mpeg',\n 'mpg',\n 'mts',\n 'ogg',\n 'qt',\n 'ts',\n 'wmv',\n]);\nregister(IconFileWord, '#185ABD', ['doc', 'docx']);\nregister(IconFileZip, vars.bdlGray20, ['tgz', 'zip']);\n\nexport const getColor = (extension?: string): Config['color'] => {\n return extension && configs[extension] ? configs[extension].color : vars.bdlBoxBlue;\n};\n\nexport const getIcon = (extension?: string): Config['icon'] => {\n return extension && configs[extension] ? configs[extension].icon : IconFileDefault;\n};\n"],"file":"previewIcons.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/preview/previewIcons.ts"],"names":["vars","IconFileAudio","IconFileBoxNote","IconFileCode","IconFileDefault","IconFileDwg","IconFileExcelSpreadsheet","IconFileGoogleDocs","IconFileGoogleSheets","IconFileGoogleSlides","IconFileIllustrator","IconFileImage","IconFileIndesign","IconFileKeynote","IconFileNumbers","IconFilePDF","IconFilePages","IconFilePhotoshop","IconFilePowerpoint","IconFilePresentation","IconFileSpreadsheet","IconFileText","IconFileThreeD","IconFileVector","IconFileVideo","IconFileWord","IconFileXbd","IconFileXdw","IconFileZip","configs","register","icon","color","extensions","forEach","extension","bdlPurpleRain","bdlGray20","bdlBoxBlue","getColor","getIcon"],"mappings":"AAAA;;;;;AAKA,OAAO,KAAKA,IAAZ,MAAsB,wBAAtB;AACA,OAAOC,aAA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AD,EAAc,SAAd,EAAyB,CAAC,KAAD,CAAzB,CAAR;AACAG,QAAQ,CAACF,WAAD,EAAc5B,IAAI,CAACqC,SAAnB,EAA8B,CAAC,KAAD,EAAQ,KAAR,CAA9B,CAAR;AAEA,OAAO,IAAME,QAAQ,GAAG,SAAXA,QAAW,CAACJ,SAAD,EAAyC;AAC7D,SAAOA,SAAS,IAAIN,OAAO,CAACM,SAAD,CAApB,GAAkCN,OAAO,CAACM,SAAD,CAAP,CAAmBH,KAArD,GAA6DhC,IAAI,CAACsC,UAAzE;AACH,CAFM;AAIP,OAAO,IAAME,OAAO,GAAG,SAAVA,OAAU,CAACL,SAAD,EAAwC;AAC3D,SAAOA,SAAS,IAAIN,OAAO,CAACM,SAAD,CAApB,GAAkCN,OAAO,CAACM,SAAD,CAAP,CAAmBJ,IAArD,GAA4D3B,eAAnE;AACH,CAFM","sourcesContent":["/**\n * Note: This map is intentionally kept separate from other icon maps, such as FileIcon. Preview only shows\n * file-specific loading icons for file types that can be previewed. Unsupported files show a default\n * icon, even if they have a relevant thumbnail/icon that is displayed within the item list, for example.\n */\nimport * as vars from '../../styles/variables';\nimport IconFileAudio from '../../icon/content/FileAudio32';\nimport IconFileBoxNote from '../../icon/content/FileBoxNote32';\nimport IconFileCode from '../../icon/content/FileCode32';\nimport IconFileDefault from '../../icon/content/FileDefault32';\nimport IconFileDwg from '../../icon/content/FileDwg32';\nimport IconFileExcelSpreadsheet from '../../icon/content/FileExcel32';\nimport IconFileGoogleDocs from '../../icon/content/FileDocs32';\nimport IconFileGoogleSheets from '../../icon/content/FileSheets32';\nimport IconFileGoogleSlides from '../../icon/content/FileSlides32';\nimport IconFileIllustrator from '../../icon/content/FileIllustrator32';\nimport IconFileImage from '../../icon/content/FileImage32';\nimport IconFileIndesign from '../../icon/content/FileIndesign32';\nimport IconFileKeynote from '../../icon/content/FileKeynote32';\nimport IconFileNumbers from '../../icon/content/FileNumbers32';\nimport IconFilePDF from '../../icon/content/FilePdf32';\nimport IconFilePages from '../../icon/content/FilePages32';\nimport IconFilePhotoshop from '../../icon/content/FilePhotoshop32';\nimport IconFilePowerpoint from '../../icon/content/FilePowerpoint32';\nimport IconFilePresentation from '../../icon/content/FilePresentation32';\nimport IconFileSpreadsheet from '../../icon/content/FileSpreadsheet32';\nimport IconFileText from '../../icon/content/FileText32';\nimport IconFileThreeD from '../../icon/content/FileThreeD32';\nimport IconFileVector from '../../icon/content/FileVector32';\nimport IconFileVideo from '../../icon/content/FileVideo32';\nimport IconFileWord from '../../icon/content/FileWord32';\nimport IconFileXbd from '../../icon/content/FileXbd32';\nimport IconFileXdw from '../../icon/content/FileXdw32';\nimport IconFileZip from '../../icon/content/FileZip32';\nimport { SVGProps } from '../accessible-svg/AccessibleSVG';\n\ntype Config = { color: string; icon: Icon };\ntype Configs = { [key: string]: Config }; // { docx: { color: '#333', icon: IconFileWord }\ntype Icon = (props: SVGProps) => JSX.Element;\n\nconst configs: Configs = {};\nconst register = (icon: Icon, color: string, extensions: string[]): void => {\n extensions.forEach(extension => {\n configs[extension] = { color, icon };\n });\n};\n\nregister(IconFileAudio, vars.bdlPurpleRain, [\n 'aac',\n 'aif',\n 'aifc',\n 'aiff',\n 'amr',\n 'au',\n 'flac',\n 'm4a',\n 'mp3',\n 'ra',\n 'wav',\n 'wma',\n]);\nregister(IconFileBoxNote, vars.bdlGray20, ['boxnote']);\nregister(IconFileCode, '#E33D55', [\n 'as',\n 'as3',\n 'asm',\n 'bat',\n 'c',\n 'cc',\n 'cmake',\n 'cpp',\n 'cs',\n 'css',\n 'cxx',\n 'diff',\n 'erb',\n 'groovy',\n 'h',\n 'haml',\n 'hh',\n 'htm',\n 'html',\n 'java',\n 'js',\n 'json',\n 'less',\n 'm',\n 'make',\n 'md',\n 'ml',\n 'mm',\n 'php',\n 'pl',\n 'plist',\n 'properties',\n 'py',\n 'rb',\n 'rst',\n 'sass',\n 'scala',\n 'script',\n 'scm',\n 'sml',\n 'sql',\n 'sh',\n 'vi',\n 'vim',\n 'xhtml',\n 'xml',\n 'xsd',\n 'xsl',\n 'yaml',\n]);\nregister(IconFileDwg, '#009AED', ['dwg']);\nregister(IconFileIllustrator, '#FF9400', ['ai']);\nregister(IconFileExcelSpreadsheet, '#107C41', ['xls', 'xlsm', 'xlsx', 'xlsb']);\nregister(IconFileGoogleDocs, '#4083F7', ['gdoc']);\nregister(IconFileGoogleSheets, '#21A464', ['gsheet']);\nregister(IconFileGoogleSlides, '#F7BA00', ['gslide', 'gslides']);\nregister(IconFileImage, '#3FB87F', [\n 'bmp',\n 'cr2',\n 'crw',\n 'dcm',\n 'dng',\n 'gif',\n 'heic',\n 'jpeg',\n 'jpg',\n 'nef',\n 'png',\n 'ps',\n 'raf',\n 'raw',\n 'svg',\n 'swf',\n 'tga',\n 'tif',\n 'tiff',\n]);\nregister(IconFileIndesign, '#FF57A1', ['idml', 'indd', 'indt', 'inx']);\nregister(IconFileKeynote, '#007AFF', ['key']);\nregister(IconFileNumbers, '#00A650', ['numbers']);\nregister(IconFilePDF, '#D0021B', ['pdf']);\nregister(IconFilePages, '#FF9500', ['pages']);\nregister(IconFilePhotoshop, '#26C9FF', ['psd']);\nregister(IconFilePowerpoint, '#C43E1C', ['ppt', 'pptx']);\nregister(IconFilePresentation, '#F7931D', ['odp']);\nregister(IconFileSpreadsheet, '#3FB87F', ['csv', 'tsv']);\nregister(IconFileText, vars.bdlBoxBlue, ['log', 'msg', 'ods', 'odt', 'rtf', 'txt', 'webdoc', 'wpd']);\nregister(IconFileThreeD, '#F7931D', ['3ds', 'box3d', 'dae', 'fbx', 'obj', 'ply', 'stl']);\nregister(IconFileVector, '#F7931D', ['eps']);\nregister(IconFileVideo, '#009AED', [\n '3g2',\n '3gp',\n 'avi',\n 'flv',\n 'm2v',\n 'm2ts',\n 'm4v',\n 'mkv',\n 'mov',\n 'mp4',\n 'mpeg',\n 'mpg',\n 'mts',\n 'ogg',\n 'qt',\n 'ts',\n 'wmv',\n]);\nregister(IconFileWord, '#185ABD', ['doc', 'docx']);\nregister(IconFileXbd, '#00838D', ['xbd']);\nregister(IconFileXdw, '#00838D', ['xdw']);\nregister(IconFileZip, vars.bdlGray20, ['tgz', 'zip']);\n\nexport const getColor = (extension?: string): Config['color'] => {\n return extension && configs[extension] ? configs[extension].color : vars.bdlBoxBlue;\n};\n\nexport const getIcon = (extension?: string): Config['icon'] => {\n return extension && configs[extension] ? configs[extension].icon : IconFileDefault;\n};\n"],"file":"previewIcons.js"}
|
|
@@ -189,7 +189,10 @@ function (_React$Component) {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
break;
|
|
192
|
-
|
|
192
|
+
|
|
193
|
+
default:
|
|
194
|
+
_this.handleInput();
|
|
195
|
+
|
|
193
196
|
}
|
|
194
197
|
});
|
|
195
198
|
|
|
@@ -334,7 +337,7 @@ function (_React$Component) {
|
|
|
334
337
|
return React.createElement(React.Fragment, null, hasDivider && React.createElement("hr", {
|
|
335
338
|
className: "SelectorDropdown-divider"
|
|
336
339
|
}), React.cloneElement(item, itemProps));
|
|
337
|
-
})); // change
|
|
340
|
+
})); // change onPaste back to onInput when React fixes this IE11 bug: https://github.com/facebook/react/issues/7280
|
|
338
341
|
// We're simulating the blur event with the tab key listener and the
|
|
339
342
|
// click listener as a proxy because IE will trigger a blur when
|
|
340
343
|
// using the scrollbar in the dropdown which indavertently closes the dropdown.
|
|
@@ -344,7 +347,6 @@ function (_React$Component) {
|
|
|
344
347
|
className: classNames('SelectorDropdown', className),
|
|
345
348
|
onFocus: this.handleFocus,
|
|
346
349
|
onKeyDown: this.handleKeyDown,
|
|
347
|
-
onKeyPress: this.handleInput,
|
|
348
350
|
onPaste: this.handleInput,
|
|
349
351
|
ref: this.selectorDropdownRef
|
|
350
352
|
}, React.cloneElement(selector, {
|
|
@@ -204,7 +204,8 @@ class SelectorDropdown extends React.Component<Props, State> {
|
|
|
204
204
|
this.resetActiveItem();
|
|
205
205
|
}
|
|
206
206
|
break;
|
|
207
|
-
|
|
207
|
+
default:
|
|
208
|
+
this.handleInput();
|
|
208
209
|
}
|
|
209
210
|
};
|
|
210
211
|
|
|
@@ -296,7 +297,7 @@ class SelectorDropdown extends React.Component<Props, State> {
|
|
|
296
297
|
</ul>
|
|
297
298
|
);
|
|
298
299
|
|
|
299
|
-
// change
|
|
300
|
+
// change onPaste back to onInput when React fixes this IE11 bug: https://github.com/facebook/react/issues/7280
|
|
300
301
|
|
|
301
302
|
// We're simulating the blur event with the tab key listener and the
|
|
302
303
|
// click listener as a proxy because IE will trigger a blur when
|
|
@@ -307,7 +308,6 @@ class SelectorDropdown extends React.Component<Props, State> {
|
|
|
307
308
|
className={classNames('SelectorDropdown', className)}
|
|
308
309
|
onFocus={this.handleFocus}
|
|
309
310
|
onKeyDown={this.handleKeyDown}
|
|
310
|
-
onKeyPress={this.handleInput}
|
|
311
311
|
onPaste={this.handleInput}
|
|
312
312
|
ref={this.selectorDropdownRef}
|
|
313
313
|
>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/selector-dropdown/SelectorDropdown.js"],"names":["React","classNames","uniqueId","scrollIntoView","ScrollWrapper","OVERLAY_WRAPPER_CLASS","stopDefaultEvent","event","preventDefault","stopPropagation","SelectorDropdown","props","index","setState","activeItemIndex","setActiveItemID","id","scrollBoundarySelector","itemEl","document","getElementById","scrollOptions","block","boundary","querySelector","activeItemID","prevChildren","children","childrenCount","Children","count","prevChildrenCount","childrenKeys","map","child","key","prevChildrenKeys","some","childKey","openDropdown","container","selectorDropdownRef","current","isInside","target","Node","contains","closeDropdown","isAlwaysOpen","onEnter","state","isDropdownOpen","nextIndex","setActiveItem","prevIndex","selectItem","resetActiveItem","shouldOpen","shouldSetActiveItemOnOpen","addEventListener","handleDocumentClick","removeEventListener","onSelect","listboxID","createRef","haveChildrenChanged","dividerIndex","overlayTitle","className","title","selector","shouldScroll","isOpen","inputProps","role","list","toLowerCase","item","itemProps","onClick","onMouseDown","onMouseEnter","isActive","hasDivider","cloneElement","handleFocus","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GAA2CA,IAF5D,CAVR;AAFJ;AAmBH;;;;EAjR0B3E,KAAK,CAACwF,S;;AAoRrC,eAAe9E,gBAAf","sourcesContent":["// @flow\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport uniqueId from 'lodash/uniqueId';\n\nimport { scrollIntoView } from '../../utils/dom';\nimport ScrollWrapper from '../scroll-wrapper';\nimport { OVERLAY_WRAPPER_CLASS } from '../../constants';\n\nimport './SelectorDropdown.scss';\n\nfunction stopDefaultEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n\ntype Props = {\n /** Options to render in the dropdown filtered based on the input text */\n children?: React.Node,\n /** CSS class for the wrapper div */\n className?: string,\n /** Index at which to insert the divider */\n dividerIndex?: number,\n /** Options to keep the results always open */\n isAlwaysOpen?: boolean,\n /** Function called on keyboard \"Enter\" event only if enter does not trigger selection */\n onEnter?: (event: SyntheticKeyboardEvent<HTMLDivElement>) => void,\n /** Function called with the index of the selected option and the event (selected by keyboard or click) */\n onSelect?: Function,\n /** Optional title of the overlay */\n overlayTitle?: string,\n /** A CSS selector matching the element to use as a boundary when auto-scrolling dropdown elements into view. When not provided, boundary will be determined by scrollIntoView utility function */\n scrollBoundarySelector?: string,\n /** Component containing an input text field and takes `inputProps` to spread onto the input element */\n selector: React.Element<any>,\n /** Boolean to indicate whether the dropdown should scroll */\n shouldScroll?: boolean,\n /** Determines whether or not the first item is highlighted automatically when the dropdown opens */\n shouldSetActiveItemOnOpen?: boolean,\n /** Optional title text that will be rendered above the list */\n title?: React.Node,\n};\n\ntype State = {\n activeItemID: string | null,\n activeItemIndex: number,\n shouldOpen: boolean,\n};\n\nclass SelectorDropdown extends React.Component<Props, State> {\n constructor(props: Props) {\n super(props);\n\n this.listboxID = uniqueId('listbox');\n\n this.state = {\n activeItemID: null,\n activeItemIndex: -1,\n shouldOpen: false,\n };\n\n this.selectorDropdownRef = React.createRef();\n }\n\n componentDidUpdate({ shouldSetActiveItemOnOpen, children }: Props) {\n if (this.haveChildrenChanged(children)) {\n // For UX purposes filtering the items is equivalent\n // to re-opening the dropdown. In such cases we highlight\n // the first item when configured to do so\n if (shouldSetActiveItemOnOpen) {\n this.setActiveItem(0);\n } else {\n this.resetActiveItem();\n }\n }\n }\n\n componentWillUnmount() {\n // just in case event listener was added during openDropdown() but the component\n // gets unmounted without closeDropdown()\n document.removeEventListener('click', this.handleDocumentClick, true);\n }\n\n setActiveItem = (index: number) => {\n this.setState({ activeItemIndex: index });\n if (index === -1) {\n this.setActiveItemID(null);\n }\n };\n\n setActiveItemID = (id: string | null) => {\n const { scrollBoundarySelector } = this.props;\n const itemEl = id ? document.getElementById(id) : null;\n\n const scrollOptions: Object = {\n block: 'nearest',\n };\n\n // Allow null in case we want to clear the default\n // boundary from scrollIntoView\n if (typeof scrollBoundarySelector !== 'undefined') {\n scrollOptions.boundary = document.querySelector(scrollBoundarySelector);\n }\n\n this.setState({ activeItemID: id }, () => {\n scrollIntoView(itemEl, scrollOptions);\n });\n };\n\n listboxID: string;\n\n selectorDropdownRef: { current: null | HTMLDivElement };\n\n haveChildrenChanged = (prevChildren?: React.Node) => {\n const { children } = this.props;\n const childrenCount = React.Children.count(children);\n const prevChildrenCount = React.Children.count(prevChildren);\n\n if (childrenCount !== prevChildrenCount) {\n return true;\n }\n\n if (childrenCount === 0) {\n return false;\n }\n\n const childrenKeys = React.Children.map(children, child => child.key);\n const prevChildrenKeys = React.Children.map(prevChildren, child => child.key);\n return childrenKeys.some((childKey, index) => childKey !== prevChildrenKeys[index]);\n };\n\n resetActiveItem = () => {\n this.setState({\n activeItemID: null,\n activeItemIndex: -1,\n });\n };\n\n handleFocus = () => {\n this.openDropdown();\n };\n\n handleDocumentClick = (event: MouseEvent) => {\n const container = this.selectorDropdownRef.current;\n const isInside =\n (container && event.target instanceof Node && container.contains(event.target)) ||\n container === event.target;\n\n if (!isInside) {\n this.closeDropdown();\n }\n };\n\n handleInput = () => {\n this.openDropdown();\n };\n\n handleKeyDown = (event: SyntheticKeyboardEvent<HTMLDivElement>) => {\n const { children, isAlwaysOpen, onEnter } = this.props;\n const { activeItemIndex } = this.state;\n const childrenCount = React.Children.count(children);\n\n switch (event.key) {\n case 'ArrowDown':\n if (this.isDropdownOpen()) {\n if (childrenCount) {\n stopDefaultEvent(event);\n }\n const nextIndex = activeItemIndex === childrenCount - 1 ? -1 : activeItemIndex + 1;\n this.setActiveItem(nextIndex);\n } else {\n this.openDropdown();\n }\n break;\n case 'ArrowUp':\n if (this.isDropdownOpen()) {\n if (childrenCount) {\n stopDefaultEvent(event);\n }\n const prevIndex = activeItemIndex === -1 ? childrenCount - 1 : activeItemIndex - 1;\n this.setActiveItem(prevIndex);\n } else {\n this.openDropdown();\n }\n break;\n case 'Enter':\n if (activeItemIndex !== -1 && this.isDropdownOpen()) {\n stopDefaultEvent(event);\n this.selectItem(activeItemIndex, event);\n } else if (onEnter) {\n onEnter(event);\n }\n break;\n case 'Tab':\n if (this.isDropdownOpen()) {\n this.closeDropdown();\n this.resetActiveItem();\n }\n break;\n case 'Escape':\n if (!isAlwaysOpen && this.isDropdownOpen()) {\n stopDefaultEvent(event);\n this.closeDropdown();\n this.resetActiveItem();\n }\n break;\n // no default\n }\n };\n\n isDropdownOpen = () => {\n const { children, isAlwaysOpen } = this.props;\n const { shouldOpen } = this.state;\n const childrenCount = React.Children.count(children);\n return childrenCount > 0 && (!!isAlwaysOpen || shouldOpen);\n };\n\n openDropdown = () => {\n if (!this.state.shouldOpen) {\n const { shouldSetActiveItemOnOpen } = this.props;\n\n if (shouldSetActiveItemOnOpen) {\n this.setActiveItem(0);\n }\n this.setState({ shouldOpen: true });\n document.addEventListener('click', this.handleDocumentClick, true);\n }\n };\n\n closeDropdown = () => {\n this.setState({ shouldOpen: false });\n document.removeEventListener('click', this.handleDocumentClick, true);\n };\n\n selectItem = (index: number, event: SyntheticEvent<>) => {\n const { onSelect } = this.props;\n if (onSelect) {\n onSelect(index, event);\n }\n this.closeDropdown();\n };\n\n render() {\n const { listboxID, selectItem, setActiveItem, setActiveItemID, closeDropdown } = this;\n const { dividerIndex, overlayTitle, children, className, title, selector, shouldScroll } = this.props;\n const { activeItemID, activeItemIndex } = this.state;\n const isOpen = this.isDropdownOpen();\n const inputProps: Object = {\n 'aria-activedescendant': activeItemID,\n 'aria-autocomplete': 'list',\n 'aria-expanded': isOpen,\n role: 'combobox',\n };\n if (isOpen) {\n inputProps['aria-owns'] = listboxID;\n }\n\n const list = (\n <ul\n className={classNames('overlay', overlayTitle ? overlayTitle.toLowerCase() : '')}\n id={listboxID}\n role=\"listbox\"\n >\n {overlayTitle && <h5 className=\"SelectorDropdown-title\">{overlayTitle}</h5>}\n {React.Children.map(children, (item, index) => {\n const itemProps: Object = {\n onClick: event => {\n selectItem(index, event);\n },\n /* preventDefault on mousedown so blur doesn't happen before click */\n onMouseDown: event => {\n event.preventDefault();\n },\n onMouseEnter: () => {\n setActiveItem(index);\n },\n closeDropdown: () => {\n closeDropdown();\n },\n setActiveItemID,\n };\n\n if (index === activeItemIndex) {\n itemProps.isActive = true;\n }\n\n const hasDivider = index === dividerIndex;\n\n return (\n <>\n {hasDivider && <hr className=\"SelectorDropdown-divider\" />}\n {React.cloneElement(item, itemProps)}\n </>\n );\n })}\n </ul>\n );\n\n // change onKeyPress/onPaste back to onInput when React fixes this IE11 bug: https://github.com/facebook/react/issues/7280\n\n // We're simulating the blur event with the tab key listener and the\n // click listener as a proxy because IE will trigger a blur when\n // using the scrollbar in the dropdown which indavertently closes the dropdown.\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className={classNames('SelectorDropdown', className)}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n onKeyPress={this.handleInput}\n onPaste={this.handleInput}\n ref={this.selectorDropdownRef}\n >\n {React.cloneElement(selector, { inputProps })}\n {isOpen && (\n <div className={`${OVERLAY_WRAPPER_CLASS} is-visible`}>\n {title}\n {shouldScroll ? <ScrollWrapper>{list}</ScrollWrapper> : list}\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default SelectorDropdown;\n"],"file":"SelectorDropdown.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/selector-dropdown/SelectorDropdown.js"],"names":["React","classNames","uniqueId","scrollIntoView","ScrollWrapper","OVERLAY_WRAPPER_CLASS","stopDefaultEvent","event","preventDefault","stopPropagation","SelectorDropdown","props","index","setState","activeItemIndex","setActiveItemID","id","scrollBoundarySelector","itemEl","document","getElementById","scrollOptions","block","boundary","querySelector","activeItemID","prevChildren","children","childrenCount","Children","count","prevChildrenCount","childrenKeys","map","child","key","prevChildrenKeys","some","childKey","openDropdown","container","selectorDropdownRef","current","isInside","target","Node","contains","closeDropdown","isAlwaysOpen","onEnter","state","isDropdownOpen","nextIndex","setActiveItem","prevIndex","selectItem","resetActiveItem","handleInput","shouldOpen","shouldSetActiveItemOnOpen","addEventListener","handleDocumentClick","removeEventListener","onSelect","listboxID","createRef","haveChildrenChanged","dividerIndex","overlayTitle","className","title","selector","shouldScroll","isOpen","inputProps","role","list","toLowerCase","item","itemProps","onClick","onMouseDown","onMouseEnter","isActive","hasDivider","cloneElement","handleFocus","handleKeyDown","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,QAAP,MAAqB,iBAArB;AAEA,SAASC,cAAT,QAA+B,iBAA/B;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,SAASC,qBAAT,QAAsC,iBAAtC;AAEA,OAAO,yBAAP;;AAEA,SAASC,gBAAT,CAA0BC,KAA1B,EAAiC;AAC7BA,EAAAA,KAAK,CAACC,cAAN;AACAD,EAAAA,KAAK,CAACE,eAAN;AACH;;IAmCKC,gB;;;;;AACF,4BAAYC,KAAZ,EAA0B;AAAA;;AAAA;;AACtB,0FAAMA,KAAN;;AADsB,oEAiCV,UAACC,KAAD,EAAmB;AAC/B,YAAKC,QAAL,CAAc;AAAEC,QAAAA,eAAe,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E,KAAK,KAAKuD,YAA7B;AAEA,eACI,0CACKiB,UAAU,IAAI;AAAI,UAAA,SAAS,EAAC;AAAd,UADnB,EAEKpF,KAAK,CAACqF,YAAN,CAAmBP,IAAnB,EAAyBC,SAAzB,CAFL,CADJ;AAMH,OA9BA,CANL,CADJ,CAfK,CAwDL;AAEA;AACA;AACA;;AACA,aACI;AACA;AACI,UAAA,SAAS,EAAE9E,UAAU,CAAC,kBAAD,EAAqBoE,SAArB,CADzB;AAEI,UAAA,OAAO,EAAE,KAAKiB,WAFlB;AAGI,UAAA,SAAS,EAAE,KAAKC,aAHpB;AAII,UAAA,OAAO,EAAE,KAAK9B,WAJlB;AAKI,UAAA,GAAG,EAAE,KAAKhB;AALd,WAOKzC,KAAK,CAACqF,YAAN,CAAmBd,QAAnB,EAA6B;AAAEG,UAAAA,UAAU,EAAVA;AAAF,SAA7B,CAPL,EAQKD,MAAM,IACH;AAAK,UAAA,SAAS,YAAKpE,qBAAL;AAAd,WACKiE,KADL,EAEKE,YAAY,GAAG,oBAAC,aAAD,QAAgBI,IAAhB,CAAH,GAA2CA,IAF5D,CATR;AAFJ;AAkBH;;;;EAjR0B5E,KAAK,CAACwF,S;;AAoRrC,eAAe9E,gBAAf","sourcesContent":["// @flow\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport uniqueId from 'lodash/uniqueId';\n\nimport { scrollIntoView } from '../../utils/dom';\nimport ScrollWrapper from '../scroll-wrapper';\nimport { OVERLAY_WRAPPER_CLASS } from '../../constants';\n\nimport './SelectorDropdown.scss';\n\nfunction stopDefaultEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n\ntype Props = {\n /** Options to render in the dropdown filtered based on the input text */\n children?: React.Node,\n /** CSS class for the wrapper div */\n className?: string,\n /** Index at which to insert the divider */\n dividerIndex?: number,\n /** Options to keep the results always open */\n isAlwaysOpen?: boolean,\n /** Function called on keyboard \"Enter\" event only if enter does not trigger selection */\n onEnter?: (event: SyntheticKeyboardEvent<HTMLDivElement>) => void,\n /** Function called with the index of the selected option and the event (selected by keyboard or click) */\n onSelect?: Function,\n /** Optional title of the overlay */\n overlayTitle?: string,\n /** A CSS selector matching the element to use as a boundary when auto-scrolling dropdown elements into view. When not provided, boundary will be determined by scrollIntoView utility function */\n scrollBoundarySelector?: string,\n /** Component containing an input text field and takes `inputProps` to spread onto the input element */\n selector: React.Element<any>,\n /** Boolean to indicate whether the dropdown should scroll */\n shouldScroll?: boolean,\n /** Determines whether or not the first item is highlighted automatically when the dropdown opens */\n shouldSetActiveItemOnOpen?: boolean,\n /** Optional title text that will be rendered above the list */\n title?: React.Node,\n};\n\ntype State = {\n activeItemID: string | null,\n activeItemIndex: number,\n shouldOpen: boolean,\n};\n\nclass SelectorDropdown extends React.Component<Props, State> {\n constructor(props: Props) {\n super(props);\n\n this.listboxID = uniqueId('listbox');\n\n this.state = {\n activeItemID: null,\n activeItemIndex: -1,\n shouldOpen: false,\n };\n\n this.selectorDropdownRef = React.createRef();\n }\n\n componentDidUpdate({ shouldSetActiveItemOnOpen, children }: Props) {\n if (this.haveChildrenChanged(children)) {\n // For UX purposes filtering the items is equivalent\n // to re-opening the dropdown. In such cases we highlight\n // the first item when configured to do so\n if (shouldSetActiveItemOnOpen) {\n this.setActiveItem(0);\n } else {\n this.resetActiveItem();\n }\n }\n }\n\n componentWillUnmount() {\n // just in case event listener was added during openDropdown() but the component\n // gets unmounted without closeDropdown()\n document.removeEventListener('click', this.handleDocumentClick, true);\n }\n\n setActiveItem = (index: number) => {\n this.setState({ activeItemIndex: index });\n if (index === -1) {\n this.setActiveItemID(null);\n }\n };\n\n setActiveItemID = (id: string | null) => {\n const { scrollBoundarySelector } = this.props;\n const itemEl = id ? document.getElementById(id) : null;\n\n const scrollOptions: Object = {\n block: 'nearest',\n };\n\n // Allow null in case we want to clear the default\n // boundary from scrollIntoView\n if (typeof scrollBoundarySelector !== 'undefined') {\n scrollOptions.boundary = document.querySelector(scrollBoundarySelector);\n }\n\n this.setState({ activeItemID: id }, () => {\n scrollIntoView(itemEl, scrollOptions);\n });\n };\n\n listboxID: string;\n\n selectorDropdownRef: { current: null | HTMLDivElement };\n\n haveChildrenChanged = (prevChildren?: React.Node) => {\n const { children } = this.props;\n const childrenCount = React.Children.count(children);\n const prevChildrenCount = React.Children.count(prevChildren);\n\n if (childrenCount !== prevChildrenCount) {\n return true;\n }\n\n if (childrenCount === 0) {\n return false;\n }\n\n const childrenKeys = React.Children.map(children, child => child.key);\n const prevChildrenKeys = React.Children.map(prevChildren, child => child.key);\n return childrenKeys.some((childKey, index) => childKey !== prevChildrenKeys[index]);\n };\n\n resetActiveItem = () => {\n this.setState({\n activeItemID: null,\n activeItemIndex: -1,\n });\n };\n\n handleFocus = () => {\n this.openDropdown();\n };\n\n handleDocumentClick = (event: MouseEvent) => {\n const container = this.selectorDropdownRef.current;\n const isInside =\n (container && event.target instanceof Node && container.contains(event.target)) ||\n container === event.target;\n\n if (!isInside) {\n this.closeDropdown();\n }\n };\n\n handleInput = () => {\n this.openDropdown();\n };\n\n handleKeyDown = (event: SyntheticKeyboardEvent<HTMLDivElement>) => {\n const { children, isAlwaysOpen, onEnter } = this.props;\n const { activeItemIndex } = this.state;\n const childrenCount = React.Children.count(children);\n\n switch (event.key) {\n case 'ArrowDown':\n if (this.isDropdownOpen()) {\n if (childrenCount) {\n stopDefaultEvent(event);\n }\n const nextIndex = activeItemIndex === childrenCount - 1 ? -1 : activeItemIndex + 1;\n this.setActiveItem(nextIndex);\n } else {\n this.openDropdown();\n }\n break;\n case 'ArrowUp':\n if (this.isDropdownOpen()) {\n if (childrenCount) {\n stopDefaultEvent(event);\n }\n const prevIndex = activeItemIndex === -1 ? childrenCount - 1 : activeItemIndex - 1;\n this.setActiveItem(prevIndex);\n } else {\n this.openDropdown();\n }\n break;\n case 'Enter':\n if (activeItemIndex !== -1 && this.isDropdownOpen()) {\n stopDefaultEvent(event);\n this.selectItem(activeItemIndex, event);\n } else if (onEnter) {\n onEnter(event);\n }\n break;\n case 'Tab':\n if (this.isDropdownOpen()) {\n this.closeDropdown();\n this.resetActiveItem();\n }\n break;\n case 'Escape':\n if (!isAlwaysOpen && this.isDropdownOpen()) {\n stopDefaultEvent(event);\n this.closeDropdown();\n this.resetActiveItem();\n }\n break;\n default:\n this.handleInput();\n }\n };\n\n isDropdownOpen = () => {\n const { children, isAlwaysOpen } = this.props;\n const { shouldOpen } = this.state;\n const childrenCount = React.Children.count(children);\n return childrenCount > 0 && (!!isAlwaysOpen || shouldOpen);\n };\n\n openDropdown = () => {\n if (!this.state.shouldOpen) {\n const { shouldSetActiveItemOnOpen } = this.props;\n\n if (shouldSetActiveItemOnOpen) {\n this.setActiveItem(0);\n }\n this.setState({ shouldOpen: true });\n document.addEventListener('click', this.handleDocumentClick, true);\n }\n };\n\n closeDropdown = () => {\n this.setState({ shouldOpen: false });\n document.removeEventListener('click', this.handleDocumentClick, true);\n };\n\n selectItem = (index: number, event: SyntheticEvent<>) => {\n const { onSelect } = this.props;\n if (onSelect) {\n onSelect(index, event);\n }\n this.closeDropdown();\n };\n\n render() {\n const { listboxID, selectItem, setActiveItem, setActiveItemID, closeDropdown } = this;\n const { dividerIndex, overlayTitle, children, className, title, selector, shouldScroll } = this.props;\n const { activeItemID, activeItemIndex } = this.state;\n const isOpen = this.isDropdownOpen();\n const inputProps: Object = {\n 'aria-activedescendant': activeItemID,\n 'aria-autocomplete': 'list',\n 'aria-expanded': isOpen,\n role: 'combobox',\n };\n if (isOpen) {\n inputProps['aria-owns'] = listboxID;\n }\n\n const list = (\n <ul\n className={classNames('overlay', overlayTitle ? overlayTitle.toLowerCase() : '')}\n id={listboxID}\n role=\"listbox\"\n >\n {overlayTitle && <h5 className=\"SelectorDropdown-title\">{overlayTitle}</h5>}\n {React.Children.map(children, (item, index) => {\n const itemProps: Object = {\n onClick: event => {\n selectItem(index, event);\n },\n /* preventDefault on mousedown so blur doesn't happen before click */\n onMouseDown: event => {\n event.preventDefault();\n },\n onMouseEnter: () => {\n setActiveItem(index);\n },\n closeDropdown: () => {\n closeDropdown();\n },\n setActiveItemID,\n };\n\n if (index === activeItemIndex) {\n itemProps.isActive = true;\n }\n\n const hasDivider = index === dividerIndex;\n\n return (\n <>\n {hasDivider && <hr className=\"SelectorDropdown-divider\" />}\n {React.cloneElement(item, itemProps)}\n </>\n );\n })}\n </ul>\n );\n\n // change onPaste back to onInput when React fixes this IE11 bug: https://github.com/facebook/react/issues/7280\n\n // We're simulating the blur event with the tab key listener and the\n // click listener as a proxy because IE will trigger a blur when\n // using the scrollbar in the dropdown which indavertently closes the dropdown.\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className={classNames('SelectorDropdown', className)}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n onPaste={this.handleInput}\n ref={this.selectorDropdownRef}\n >\n {React.cloneElement(selector, { inputProps })}\n {isOpen && (\n <div className={`${OVERLAY_WRAPPER_CLASS} is-visible`}>\n {title}\n {shouldScroll ? <ScrollWrapper>{list}</ScrollWrapper> : list}\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default SelectorDropdown;\n"],"file":"SelectorDropdown.js"}
|
|
@@ -165,6 +165,8 @@ function (_React$Component) {
|
|
|
165
165
|
|
|
166
166
|
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
|
|
167
167
|
if (event.key === 'Escape') {
|
|
168
|
+
event.stopPropagation();
|
|
169
|
+
|
|
168
170
|
_this.setState({
|
|
169
171
|
isShown: false
|
|
170
172
|
});
|
|
@@ -200,16 +202,32 @@ function (_React$Component) {
|
|
|
200
202
|
}
|
|
201
203
|
}, {
|
|
202
204
|
key: "componentDidUpdate",
|
|
203
|
-
value: function componentDidUpdate(prevProps) {
|
|
204
|
-
// Reset wasClosedByUser state when isShown transitions from false to true
|
|
205
|
-
|
|
205
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
206
|
+
var isControlled = this.isControlled(); // Reset wasClosedByUser state when isShown transitions from false to true
|
|
207
|
+
|
|
208
|
+
if (isControlled) {
|
|
206
209
|
if (!prevProps.isShown && this.props.isShown) {
|
|
207
210
|
this.setState({
|
|
208
211
|
wasClosedByUser: false
|
|
209
212
|
});
|
|
210
213
|
}
|
|
214
|
+
} else {
|
|
215
|
+
if (!prevState.isShown && this.state.isShown) {
|
|
216
|
+
// capture event so that tooltip closes before any other floating components that can be closed by
|
|
217
|
+
// "Escape" key(e.g. Modal, Menu, etc.)
|
|
218
|
+
document.addEventListener('keydown', this.handleKeyDown, true);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (prevState.isShown && !this.state.isShown) {
|
|
222
|
+
document.removeEventListener('keydown', this.handleKeyDown, true);
|
|
223
|
+
}
|
|
211
224
|
}
|
|
212
225
|
}
|
|
226
|
+
}, {
|
|
227
|
+
key: "componentWillUnmount",
|
|
228
|
+
value: function componentWillUnmount() {
|
|
229
|
+
document.removeEventListener('keydown', this.handleKeyDown, true);
|
|
230
|
+
}
|
|
213
231
|
}, {
|
|
214
232
|
key: "render",
|
|
215
233
|
value: function render() {
|
|
@@ -271,7 +289,6 @@ function (_React$Component) {
|
|
|
271
289
|
if (!isControlled) {
|
|
272
290
|
componentProps.onBlur = this.handleBlur;
|
|
273
291
|
componentProps.onFocus = this.handleFocus;
|
|
274
|
-
componentProps.onKeyDown = this.handleKeyDown;
|
|
275
292
|
componentProps.onMouseEnter = this.handleMouseEnter;
|
|
276
293
|
componentProps.onMouseLeave = this.handleMouseLeave;
|
|
277
294
|
|