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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
2
|
|
|
3
|
-
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); }
|
|
4
|
-
|
|
5
3
|
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; }
|
|
6
4
|
|
|
7
5
|
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; }
|
|
8
6
|
|
|
7
|
+
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); }
|
|
8
|
+
|
|
9
9
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
10
|
|
|
11
11
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -27,15 +27,15 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
27
27
|
import * as React from 'react';
|
|
28
28
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
|
29
29
|
import classNames from 'classnames';
|
|
30
|
-
import Pikaday from 'pikaday';
|
|
31
30
|
import noop from 'lodash/noop';
|
|
32
31
|
import range from 'lodash/range';
|
|
33
32
|
import uniqueId from 'lodash/uniqueId'; // @ts-ignore flow import
|
|
34
33
|
|
|
35
34
|
import { RESIN_TAG_TARGET } from '../../common/variables';
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
35
|
+
import Alert16 from '../../icon/fill/Alert16';
|
|
36
|
+
import Calendar16 from '../../icon/fill/Calendar16';
|
|
37
|
+
import ClearBadge16 from '../../icon/fill/ClearBadge16';
|
|
38
|
+
import AccessiblePikaday from './AccessiblePikaday';
|
|
39
39
|
import { ButtonType } from '../button';
|
|
40
40
|
import Label from '../label';
|
|
41
41
|
import PlainButton from '../plain-button';
|
|
@@ -63,12 +63,25 @@ var messages = defineMessages({
|
|
|
63
63
|
chooseDate: {
|
|
64
64
|
"id": "boxui.datePicker.chooseDate",
|
|
65
65
|
"defaultMessage": "Choose Date"
|
|
66
|
+
},
|
|
67
|
+
dateInputRangeError: {
|
|
68
|
+
"id": "boxui.datePicker.dateInputRangeError",
|
|
69
|
+
"defaultMessage": "Please enter a date between {minLocaleDate} and {maxLocaleDate}"
|
|
70
|
+
},
|
|
71
|
+
dateInputMaxError: {
|
|
72
|
+
"id": "boxui.datePicker.dateInputMaxError",
|
|
73
|
+
"defaultMessage": "Please enter a date before {maxLocaleDate}"
|
|
74
|
+
},
|
|
75
|
+
dateInputMinError: {
|
|
76
|
+
"id": "boxui.datePicker.dateInputMinError",
|
|
77
|
+
"defaultMessage": "Please enter a date after {minLocaleDate}"
|
|
66
78
|
}
|
|
67
79
|
});
|
|
68
80
|
var TOGGLE_DELAY_MS = 300;
|
|
69
81
|
var ENTER_KEY = 'Enter';
|
|
70
82
|
var ESCAPE_KEY = 'Escape';
|
|
71
83
|
var TAB_KEY = 'Tab';
|
|
84
|
+
var ISO_DATE_FORMAT_PATTERN = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/;
|
|
72
85
|
export var DateFormat;
|
|
73
86
|
/**
|
|
74
87
|
* Converts date from being relative to GMT, to being relative to browser
|
|
@@ -80,6 +93,7 @@ export var DateFormat;
|
|
|
80
93
|
|
|
81
94
|
(function (DateFormat) {
|
|
82
95
|
DateFormat["ISO_STRING_DATE_FORMAT"] = "isoString";
|
|
96
|
+
DateFormat["LOCALE_DATE_STRING_DATE_FORMAT"] = "localeDateString";
|
|
83
97
|
DateFormat["UTC_TIME_DATE_FORMAT"] = "utcTime";
|
|
84
98
|
DateFormat["UNIX_TIME_DATE_FORMAT"] = "unixTime";
|
|
85
99
|
DateFormat["UTC_ISO_STRING_DATE_FORMAT"] = "utcISOString";
|
|
@@ -103,6 +117,9 @@ function getFormattedDate(date, format) {
|
|
|
103
117
|
case DateFormat.ISO_STRING_DATE_FORMAT:
|
|
104
118
|
return date.toISOString();
|
|
105
119
|
|
|
120
|
+
case DateFormat.LOCALE_DATE_STRING_DATE_FORMAT:
|
|
121
|
+
return date.toLocaleDateString();
|
|
122
|
+
|
|
106
123
|
case DateFormat.UTC_TIME_DATE_FORMAT:
|
|
107
124
|
return convertDateToUnixMidnightTime(date);
|
|
108
125
|
|
|
@@ -135,47 +152,116 @@ function (_React$Component) {
|
|
|
135
152
|
|
|
136
153
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DatePicker)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
137
154
|
|
|
155
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
156
|
+
isDateInputInvalid: false,
|
|
157
|
+
showDateInputError: false
|
|
158
|
+
});
|
|
159
|
+
|
|
138
160
|
_defineProperty(_assertThisInitialized(_this), "errorMessageID", uniqueId('errorMessage'));
|
|
139
161
|
|
|
140
162
|
_defineProperty(_assertThisInitialized(_this), "descriptionID", uniqueId('description'));
|
|
141
163
|
|
|
142
164
|
_defineProperty(_assertThisInitialized(_this), "onSelectHandler", function () {
|
|
143
165
|
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
144
|
-
var
|
|
166
|
+
var _this$props = _this.props,
|
|
167
|
+
onChange = _this$props.onChange,
|
|
168
|
+
isAccessible = _this$props.isAccessible;
|
|
169
|
+
var isDateInputInvalid = _this.state.isDateInputInvalid;
|
|
145
170
|
|
|
146
171
|
if (onChange) {
|
|
147
172
|
var formattedDate = _this.formatValue(date);
|
|
148
173
|
|
|
149
174
|
onChange(date, formattedDate);
|
|
150
175
|
}
|
|
176
|
+
|
|
177
|
+
if (isAccessible) {
|
|
178
|
+
if (_this.dateInputEl && _this.datePicker) {
|
|
179
|
+
// Required because Pikaday instance is unbound
|
|
180
|
+
// See https://github.com/Pikaday/Pikaday#usage
|
|
181
|
+
_this.dateInputEl.value = _this.datePicker.toString();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (_this.datePicker && _this.datePicker.isVisible()) {
|
|
185
|
+
_this.datePicker.hide();
|
|
186
|
+
|
|
187
|
+
_this.focusDatePicker();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (isDateInputInvalid) {
|
|
192
|
+
_this.setState({
|
|
193
|
+
isDateInputInvalid: false,
|
|
194
|
+
showDateInputError: false
|
|
195
|
+
});
|
|
196
|
+
}
|
|
151
197
|
});
|
|
152
198
|
|
|
153
199
|
_defineProperty(_assertThisInitialized(_this), "datePicker", null);
|
|
154
200
|
|
|
201
|
+
_defineProperty(_assertThisInitialized(_this), "canUseDateInputType", true);
|
|
202
|
+
|
|
155
203
|
_defineProperty(_assertThisInitialized(_this), "shouldStayClosed", false);
|
|
156
204
|
|
|
157
205
|
_defineProperty(_assertThisInitialized(_this), "focusDatePicker", function () {
|
|
158
|
-
//
|
|
206
|
+
// This also opens the date picker when isAccessible is disabled
|
|
159
207
|
if (_this.dateInputEl) {
|
|
160
208
|
_this.dateInputEl.focus();
|
|
161
209
|
}
|
|
162
210
|
});
|
|
163
211
|
|
|
212
|
+
_defineProperty(_assertThisInitialized(_this), "getDateInputError", function () {
|
|
213
|
+
var _this$props2 = _this.props,
|
|
214
|
+
intl = _this$props2.intl,
|
|
215
|
+
_this$props2$maxDate = _this$props2.maxDate,
|
|
216
|
+
maxDate = _this$props2$maxDate === void 0 ? null : _this$props2$maxDate,
|
|
217
|
+
_this$props2$minDate = _this$props2.minDate,
|
|
218
|
+
minDate = _this$props2$minDate === void 0 ? null : _this$props2$minDate;
|
|
219
|
+
var showDateInputError = _this.state.showDateInputError;
|
|
220
|
+
var formatMessage = intl.formatMessage;
|
|
221
|
+
if (!showDateInputError) return '';
|
|
222
|
+
var dateInputError = '';
|
|
223
|
+
var maxLocaleDate = getFormattedDate(maxDate, DateFormat.LOCALE_DATE_STRING_DATE_FORMAT);
|
|
224
|
+
var minLocaleDate = getFormattedDate(minDate, DateFormat.LOCALE_DATE_STRING_DATE_FORMAT);
|
|
225
|
+
|
|
226
|
+
if (maxLocaleDate && minLocaleDate) {
|
|
227
|
+
dateInputError = formatMessage(messages.dateInputRangeError, {
|
|
228
|
+
maxLocaleDate: maxLocaleDate,
|
|
229
|
+
minLocaleDate: minLocaleDate
|
|
230
|
+
});
|
|
231
|
+
} else if (maxLocaleDate) {
|
|
232
|
+
dateInputError = formatMessage(messages.dateInputMaxError, {
|
|
233
|
+
maxLocaleDate: maxLocaleDate
|
|
234
|
+
});
|
|
235
|
+
} else if (minLocaleDate) {
|
|
236
|
+
dateInputError = formatMessage(messages.dateInputMinError, {
|
|
237
|
+
minLocaleDate: minLocaleDate
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return dateInputError;
|
|
242
|
+
});
|
|
243
|
+
|
|
164
244
|
_defineProperty(_assertThisInitialized(_this), "handleInputKeyDown", function (event) {
|
|
165
|
-
var _this$
|
|
166
|
-
isKeyboardInputAllowed = _this$
|
|
167
|
-
isTextInputAllowed = _this$
|
|
245
|
+
var _this$props3 = _this.props,
|
|
246
|
+
isKeyboardInputAllowed = _this$props3.isKeyboardInputAllowed,
|
|
247
|
+
isTextInputAllowed = _this$props3.isTextInputAllowed,
|
|
248
|
+
isAccessible = _this$props3.isAccessible;
|
|
168
249
|
|
|
169
250
|
if (!isKeyboardInputAllowed && _this.datePicker && _this.datePicker.isVisible()) {
|
|
170
251
|
event.stopPropagation();
|
|
171
252
|
} // Stops up/down arrow & spacebar from moving page scroll position since pikaday does not preventDefault correctly
|
|
172
253
|
|
|
173
254
|
|
|
174
|
-
if (!isTextInputAllowed && event.key !== TAB_KEY) {
|
|
255
|
+
if (!(isTextInputAllowed || isAccessible) && event.key !== TAB_KEY) {
|
|
175
256
|
event.preventDefault();
|
|
176
257
|
}
|
|
177
258
|
|
|
178
|
-
if (isTextInputAllowed && event.key === ENTER_KEY) {
|
|
259
|
+
if ((isTextInputAllowed || isAccessible && !_this.canUseDateInputType) && event.key === ENTER_KEY) {
|
|
260
|
+
event.preventDefault();
|
|
261
|
+
} // Stops enter & spacebar from opening up the browser's default date picker
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
if (isAccessible && (event.key === ENTER_KEY || event.key === ' ')) {
|
|
179
265
|
event.preventDefault();
|
|
180
266
|
}
|
|
181
267
|
|
|
@@ -187,10 +273,73 @@ function (_React$Component) {
|
|
|
187
273
|
}
|
|
188
274
|
});
|
|
189
275
|
|
|
276
|
+
_defineProperty(_assertThisInitialized(_this), "handleOnChange", function (event) {
|
|
277
|
+
var _this$props4 = _this.props,
|
|
278
|
+
isAccessible = _this$props4.isAccessible,
|
|
279
|
+
maxDate = _this$props4.maxDate,
|
|
280
|
+
minDate = _this$props4.minDate,
|
|
281
|
+
onChange = _this$props4.onChange;
|
|
282
|
+
var isDateInputInvalid = _this.state.isDateInputInvalid;
|
|
283
|
+
|
|
284
|
+
if (!isAccessible || !_this.canUseDateInputType) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (_this.datePicker && _this.datePicker.isVisible()) {
|
|
289
|
+
event.stopPropagation();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
var value = event.target.value;
|
|
293
|
+
|
|
294
|
+
if (_this.datePicker && value) {
|
|
295
|
+
var parsedDate = _this.parseDisplayDateType(value);
|
|
296
|
+
|
|
297
|
+
if (parsedDate) {
|
|
298
|
+
if (minDate && parsedDate < minDate || maxDate && parsedDate > maxDate) {
|
|
299
|
+
_this.datePicker.setDate(null);
|
|
300
|
+
|
|
301
|
+
_this.setState({
|
|
302
|
+
isDateInputInvalid: true
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
return;
|
|
306
|
+
} // Reset the error styling on valid date input
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
if (isDateInputInvalid) {
|
|
310
|
+
_this.setState({
|
|
311
|
+
isDateInputInvalid: false,
|
|
312
|
+
showDateInputError: false
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
} else {
|
|
316
|
+
_this.setState({
|
|
317
|
+
isDateInputInvalid: true
|
|
318
|
+
});
|
|
319
|
+
} // Set date so Pikaday date picker value stays in sync with input
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
_this.datePicker.setDate(parsedDate, true);
|
|
323
|
+
|
|
324
|
+
if (onChange) {
|
|
325
|
+
var formattedDate = _this.formatValue(parsedDate);
|
|
326
|
+
|
|
327
|
+
onChange(parsedDate, formattedDate);
|
|
328
|
+
}
|
|
329
|
+
} else if (isDateInputInvalid) {
|
|
330
|
+
_this.setState({
|
|
331
|
+
isDateInputInvalid: false,
|
|
332
|
+
showDateInputError: false
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
|
|
190
337
|
_defineProperty(_assertThisInitialized(_this), "handleInputBlur", function (event) {
|
|
191
|
-
var _this$
|
|
192
|
-
|
|
193
|
-
isTextInputAllowed = _this$
|
|
338
|
+
var _this$props5 = _this.props,
|
|
339
|
+
isAccessible = _this$props5.isAccessible,
|
|
340
|
+
isTextInputAllowed = _this$props5.isTextInputAllowed,
|
|
341
|
+
onBlur = _this$props5.onBlur;
|
|
342
|
+
var isDateInputInvalid = _this.state.isDateInputInvalid;
|
|
194
343
|
var nextActiveElement = event.relatedTarget || document.activeElement; // This is mostly here to cancel out the pikaday hide() on blur
|
|
195
344
|
|
|
196
345
|
if (_this.datePicker && _this.datePicker.isVisible() && nextActiveElement && nextActiveElement === _this.datePickerButtonEl) {
|
|
@@ -202,50 +351,155 @@ function (_React$Component) {
|
|
|
202
351
|
|
|
203
352
|
if (onBlur) {
|
|
204
353
|
onBlur(event);
|
|
205
|
-
} // Since we
|
|
354
|
+
} // Since we fire parent onChange event if isTextInputAllowed,
|
|
206
355
|
// fire it on blur if the user typed a correct date format
|
|
207
356
|
|
|
208
357
|
|
|
209
358
|
var inputDate = null;
|
|
210
359
|
|
|
211
360
|
if (_this.dateInputEl) {
|
|
212
|
-
|
|
361
|
+
var dateInputElVal = null;
|
|
362
|
+
|
|
363
|
+
if (isAccessible && !_this.canUseDateInputType) {
|
|
364
|
+
dateInputElVal = _this.parseDisplayDateType(_this.dateInputEl.value);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
inputDate = new Date(dateInputElVal || _this.dateInputEl.value);
|
|
213
368
|
}
|
|
214
369
|
|
|
215
|
-
if (isTextInputAllowed && inputDate && inputDate.getDate()) {
|
|
370
|
+
if ((isTextInputAllowed || isAccessible && !_this.canUseDateInputType) && inputDate && inputDate.getDate()) {
|
|
216
371
|
_this.onSelectHandler(inputDate);
|
|
217
372
|
}
|
|
373
|
+
|
|
374
|
+
if (isAccessible && isDateInputInvalid) _this.setState({
|
|
375
|
+
showDateInputError: true
|
|
376
|
+
});
|
|
218
377
|
});
|
|
219
378
|
|
|
220
379
|
_defineProperty(_assertThisInitialized(_this), "handleButtonClick", function (event) {
|
|
221
380
|
event.preventDefault();
|
|
222
381
|
event.stopPropagation();
|
|
382
|
+
var _this$props6 = _this.props,
|
|
383
|
+
isAccessible = _this$props6.isAccessible,
|
|
384
|
+
isDisabled = _this$props6.isDisabled;
|
|
385
|
+
|
|
386
|
+
if (isAccessible) {
|
|
387
|
+
if (isDisabled || !_this.datePicker) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
if (_this.datePicker.isVisible()) {
|
|
392
|
+
_this.datePicker.hide();
|
|
393
|
+
|
|
394
|
+
_this.focusDatePicker();
|
|
395
|
+
} else {
|
|
396
|
+
_this.datePicker.show();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
223
401
|
|
|
224
402
|
if (!_this.shouldStayClosed) {
|
|
225
403
|
_this.focusDatePicker();
|
|
226
404
|
}
|
|
227
405
|
});
|
|
228
406
|
|
|
407
|
+
_defineProperty(_assertThisInitialized(_this), "handleOnClick", function (event) {
|
|
408
|
+
var isAccessible = _this.props.isAccessible;
|
|
409
|
+
|
|
410
|
+
if (isAccessible) {
|
|
411
|
+
// Suppress Firefox default behavior: clicking on input type "date"
|
|
412
|
+
// opens the browser date picker.
|
|
413
|
+
event.preventDefault();
|
|
414
|
+
event.stopPropagation();
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
|
|
229
418
|
_defineProperty(_assertThisInitialized(_this), "formatDisplay", function (date) {
|
|
230
|
-
var _this$
|
|
231
|
-
displayFormat = _this$
|
|
232
|
-
intl = _this$
|
|
419
|
+
var _this$props7 = _this.props,
|
|
420
|
+
displayFormat = _this$props7.displayFormat,
|
|
421
|
+
intl = _this$props7.intl;
|
|
233
422
|
return date ? intl.formatDate(date, displayFormat) : '';
|
|
234
423
|
});
|
|
235
424
|
|
|
425
|
+
_defineProperty(_assertThisInitialized(_this), "formatDisplayDateType", function (date) {
|
|
426
|
+
// Input type "date" only accepts the format YYYY-MM-DD
|
|
427
|
+
return date ? getFormattedDate(date, DateFormat.UTC_ISO_STRING_DATE_FORMAT).slice(0, 10) : '';
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
_defineProperty(_assertThisInitialized(_this), "parseDisplayDateType", function (dateString) {
|
|
431
|
+
if (dateString && ISO_DATE_FORMAT_PATTERN.test(dateString)) {
|
|
432
|
+
// Calling new Date('YYYY-MM-DD') without 'T00:00:00' yields undesired results:
|
|
433
|
+
// E.g. new Date('2017-06-01') => May 31 2017
|
|
434
|
+
// E.g. new Date('2017-06-01T00:00:00') => June 01 2017
|
|
435
|
+
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#parameters
|
|
436
|
+
return new Date("".concat(dateString, "T00:00:00"));
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return null;
|
|
440
|
+
});
|
|
441
|
+
|
|
236
442
|
_defineProperty(_assertThisInitialized(_this), "formatValue", function (date) {
|
|
237
443
|
var dateFormat = _this.props.dateFormat;
|
|
238
444
|
return dateFormat ? getFormattedDate(date, dateFormat) : '';
|
|
239
445
|
});
|
|
240
446
|
|
|
241
447
|
_defineProperty(_assertThisInitialized(_this), "clearDate", function (event) {
|
|
242
|
-
|
|
448
|
+
// Prevents the date picker from opening after clearing
|
|
449
|
+
event.preventDefault();
|
|
450
|
+
var isAccessible = _this.props.isAccessible;
|
|
243
451
|
|
|
244
452
|
if (_this.datePicker) {
|
|
245
453
|
_this.datePicker.setDate(null);
|
|
246
454
|
}
|
|
247
455
|
|
|
248
456
|
_this.onSelectHandler(null);
|
|
457
|
+
|
|
458
|
+
if (isAccessible) {
|
|
459
|
+
_this.focusDatePicker();
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
_defineProperty(_assertThisInitialized(_this), "shouldUseAccessibleFallback", function () {
|
|
464
|
+
var test = document.createElement('input');
|
|
465
|
+
|
|
466
|
+
try {
|
|
467
|
+
test.type = 'date';
|
|
468
|
+
} catch (e) {} // no-op
|
|
469
|
+
// If date input falls back to text input, show the fallback
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
return test.type === 'text';
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
_defineProperty(_assertThisInitialized(_this), "renderCalendarButton", function () {
|
|
476
|
+
var _this$props8 = _this.props,
|
|
477
|
+
intl = _this$props8.intl,
|
|
478
|
+
isAccessible = _this$props8.isAccessible,
|
|
479
|
+
isAlwaysVisible = _this$props8.isAlwaysVisible,
|
|
480
|
+
isDisabled = _this$props8.isDisabled;
|
|
481
|
+
var formatMessage = intl.formatMessage;
|
|
482
|
+
|
|
483
|
+
if (isAlwaysVisible) {
|
|
484
|
+
return null;
|
|
485
|
+
} // De-emphasizing the Pikaday date picker because it does not meet accessibility standards
|
|
486
|
+
// Screenreaders & navigating via keyboard will no longer pick up on this element
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
var accessibleAttrs = isAccessible ? {
|
|
490
|
+
'aria-hidden': true,
|
|
491
|
+
tabIndex: -1
|
|
492
|
+
} : {};
|
|
493
|
+
return React.createElement(PlainButton, _extends({
|
|
494
|
+
"aria-label": formatMessage(messages.chooseDate),
|
|
495
|
+
className: "date-picker-open-btn",
|
|
496
|
+
getDOMRef: function getDOMRef(ref) {
|
|
497
|
+
_this.datePickerButtonEl = ref;
|
|
498
|
+
},
|
|
499
|
+
isDisabled: isDisabled,
|
|
500
|
+
onClick: _this.handleButtonClick,
|
|
501
|
+
type: ButtonType.BUTTON
|
|
502
|
+
}, accessibleAttrs), React.createElement(Calendar16, null));
|
|
249
503
|
});
|
|
250
504
|
|
|
251
505
|
return _this;
|
|
@@ -254,52 +508,72 @@ function (_React$Component) {
|
|
|
254
508
|
_createClass(DatePicker, [{
|
|
255
509
|
key: "componentDidMount",
|
|
256
510
|
value: function componentDidMount() {
|
|
257
|
-
var _this$
|
|
258
|
-
customInput = _this$
|
|
259
|
-
dateFormat = _this$
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
511
|
+
var _this$props9 = this.props,
|
|
512
|
+
customInput = _this$props9.customInput,
|
|
513
|
+
dateFormat = _this$props9.dateFormat,
|
|
514
|
+
displayFormat = _this$props9.displayFormat,
|
|
515
|
+
intl = _this$props9.intl,
|
|
516
|
+
isAccessible = _this$props9.isAccessible,
|
|
517
|
+
isAlwaysVisible = _this$props9.isAlwaysVisible,
|
|
518
|
+
isTextInputAllowed = _this$props9.isTextInputAllowed,
|
|
519
|
+
maxDate = _this$props9.maxDate,
|
|
520
|
+
minDate = _this$props9.minDate,
|
|
521
|
+
onChange = _this$props9.onChange,
|
|
522
|
+
value = _this$props9.value,
|
|
523
|
+
yearRange = _this$props9.yearRange;
|
|
267
524
|
var formatDate = intl.formatDate,
|
|
268
525
|
formatMessage = intl.formatMessage;
|
|
269
526
|
var nextMonth = messages.nextMonth,
|
|
270
527
|
previousMonth = messages.previousMonth;
|
|
271
|
-
var defaultValue = value;
|
|
528
|
+
var defaultValue = value;
|
|
529
|
+
|
|
530
|
+
if (isAccessible && this.shouldUseAccessibleFallback()) {
|
|
531
|
+
this.canUseDateInputType = false;
|
|
532
|
+
} // When date format is utcTime, initial date needs to be converted from being relative to GMT to being
|
|
272
533
|
// relative to browser timezone
|
|
273
534
|
|
|
535
|
+
|
|
274
536
|
if (dateFormat === DateFormat.UTC_TIME_DATE_FORMAT && value) {
|
|
275
537
|
defaultValue = convertUTCToLocal(value);
|
|
538
|
+
|
|
539
|
+
if (onChange) {
|
|
540
|
+
var formattedDate = this.formatValue(defaultValue);
|
|
541
|
+
onChange(defaultValue, formattedDate);
|
|
542
|
+
}
|
|
276
543
|
} // Make sure the DST detection algorithm in browsers is up-to-date
|
|
277
544
|
|
|
278
545
|
|
|
279
546
|
var year = new Date().getFullYear();
|
|
547
|
+
|
|
548
|
+
var _ref = displayFormat || {},
|
|
549
|
+
timeZone = _ref.timeZone;
|
|
550
|
+
|
|
280
551
|
var i18n = {
|
|
281
552
|
previousMonth: formatMessage(previousMonth),
|
|
282
553
|
nextMonth: formatMessage(nextMonth),
|
|
283
554
|
months: range(12).map(function (month) {
|
|
284
555
|
return formatDate(new Date(year, month, 15), {
|
|
285
|
-
month: 'long'
|
|
556
|
+
month: 'long',
|
|
557
|
+
timeZone: timeZone
|
|
286
558
|
});
|
|
287
559
|
}),
|
|
288
560
|
// weekdays must start with Sunday, so array of dates below is May 1st-8th, 2016
|
|
289
561
|
weekdays: range(1, 8).map(function (date) {
|
|
290
562
|
return formatDate(new Date(2016, 4, date), {
|
|
291
|
-
weekday: 'long'
|
|
563
|
+
weekday: 'long',
|
|
564
|
+
timeZone: timeZone
|
|
292
565
|
});
|
|
293
566
|
}),
|
|
294
567
|
weekdaysShort: range(1, 8).map(function (date) {
|
|
295
568
|
return formatDate(new Date(2016, 4, date), {
|
|
296
|
-
weekday: 'narrow'
|
|
569
|
+
weekday: 'narrow',
|
|
570
|
+
timeZone: timeZone
|
|
297
571
|
});
|
|
298
572
|
})
|
|
299
573
|
}; // If "bound" is true (default), the DatePicker will be appended at the end of the document, with absolute positioning
|
|
300
574
|
// If "bound" is false, the DatePicker will be appended to the DOM right after the input, with relative positioning
|
|
301
575
|
|
|
302
|
-
|
|
576
|
+
var datePickerConfig = {
|
|
303
577
|
bound: !customInput,
|
|
304
578
|
blurFieldOnSelect: false,
|
|
305
579
|
// Available in pikaday > 1.5.1
|
|
@@ -315,7 +589,22 @@ function (_React$Component) {
|
|
|
315
589
|
onSelect: this.onSelectHandler,
|
|
316
590
|
yearRange: yearRange,
|
|
317
591
|
toString: this.formatDisplay
|
|
318
|
-
}
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
if (isAccessible) {
|
|
595
|
+
if (this.canUseDateInputType) {
|
|
596
|
+
delete datePickerConfig.field;
|
|
597
|
+
datePickerConfig.trigger = this.dateInputEl;
|
|
598
|
+
datePickerConfig.accessibleFieldEl = this.dateInputEl;
|
|
599
|
+
datePickerConfig.datePickerButtonEl = this.datePickerButtonEl;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
datePickerConfig.parse = this.parseDisplayDateType;
|
|
603
|
+
datePickerConfig.toString = this.formatDisplayDateType;
|
|
604
|
+
datePickerConfig.keyboardInput = false;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
this.datePicker = new AccessiblePikaday(datePickerConfig);
|
|
319
608
|
|
|
320
609
|
if (isTextInputAllowed) {
|
|
321
610
|
this.updateDateInputValue(this.formatDisplay(defaultValue));
|
|
@@ -337,11 +626,11 @@ function (_React$Component) {
|
|
|
337
626
|
nextMinDate = _nextProps$minDate === void 0 ? null : _nextProps$minDate,
|
|
338
627
|
_nextProps$maxDate = nextProps.maxDate,
|
|
339
628
|
nextMaxDate = _nextProps$maxDate === void 0 ? null : _nextProps$maxDate;
|
|
340
|
-
var _this$
|
|
341
|
-
value = _this$
|
|
342
|
-
minDate = _this$
|
|
343
|
-
maxDate = _this$
|
|
344
|
-
isTextInputAllowed = _this$
|
|
629
|
+
var _this$props10 = this.props,
|
|
630
|
+
value = _this$props10.value,
|
|
631
|
+
minDate = _this$props10.minDate,
|
|
632
|
+
maxDate = _this$props10.maxDate,
|
|
633
|
+
isTextInputAllowed = _this$props10.isTextInputAllowed;
|
|
345
634
|
var selectedDate = this.datePicker && this.datePicker.getDate(); // only set date when props change
|
|
346
635
|
|
|
347
636
|
if (nextValue && !value || !nextValue && value || nextValue && value && nextValue.getTime() !== value.getTime()) {
|
|
@@ -389,33 +678,38 @@ function (_React$Component) {
|
|
|
389
678
|
value: function render() {
|
|
390
679
|
var _this2 = this;
|
|
391
680
|
|
|
392
|
-
var _this$
|
|
393
|
-
className = _this$
|
|
394
|
-
customInput = _this$
|
|
395
|
-
description = _this$
|
|
396
|
-
error = _this$
|
|
397
|
-
errorTooltipPosition = _this$
|
|
398
|
-
hideLabel = _this$
|
|
399
|
-
hideOptionalLabel = _this$
|
|
400
|
-
inputProps = _this$
|
|
401
|
-
intl = _this$
|
|
402
|
-
|
|
403
|
-
isClearable = _this$
|
|
404
|
-
isDisabled = _this$
|
|
405
|
-
isRequired = _this$
|
|
406
|
-
isTextInputAllowed = _this$
|
|
407
|
-
label = _this$
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
681
|
+
var _this$props11 = this.props,
|
|
682
|
+
className = _this$props11.className,
|
|
683
|
+
customInput = _this$props11.customInput,
|
|
684
|
+
description = _this$props11.description,
|
|
685
|
+
error = _this$props11.error,
|
|
686
|
+
errorTooltipPosition = _this$props11.errorTooltipPosition,
|
|
687
|
+
hideLabel = _this$props11.hideLabel,
|
|
688
|
+
hideOptionalLabel = _this$props11.hideOptionalLabel,
|
|
689
|
+
inputProps = _this$props11.inputProps,
|
|
690
|
+
intl = _this$props11.intl,
|
|
691
|
+
isAccessible = _this$props11.isAccessible,
|
|
692
|
+
isClearable = _this$props11.isClearable,
|
|
693
|
+
isDisabled = _this$props11.isDisabled,
|
|
694
|
+
isRequired = _this$props11.isRequired,
|
|
695
|
+
isTextInputAllowed = _this$props11.isTextInputAllowed,
|
|
696
|
+
label = _this$props11.label,
|
|
697
|
+
maxDate = _this$props11.maxDate,
|
|
698
|
+
minDate = _this$props11.minDate,
|
|
699
|
+
name = _this$props11.name,
|
|
700
|
+
onFocus = _this$props11.onFocus,
|
|
701
|
+
placeholder = _this$props11.placeholder,
|
|
702
|
+
resinTarget = _this$props11.resinTarget,
|
|
703
|
+
value = _this$props11.value;
|
|
704
|
+
var isDateInputInvalid = this.state.isDateInputInvalid;
|
|
413
705
|
var formatMessage = intl.formatMessage;
|
|
706
|
+
var errorMessage = error || this.getDateInputError();
|
|
707
|
+
var hasError = !!errorMessage || isDateInputInvalid;
|
|
708
|
+
var hasValue = !!value || isDateInputInvalid;
|
|
414
709
|
var classes = classNames(className, 'date-picker-wrapper', {
|
|
415
|
-
'show-clear-btn':
|
|
416
|
-
'show-error':
|
|
710
|
+
'show-clear-btn': isClearable && hasValue && !isDisabled,
|
|
711
|
+
'show-error': hasError
|
|
417
712
|
});
|
|
418
|
-
var hasError = !!error;
|
|
419
713
|
var ariaAttrs = {
|
|
420
714
|
'aria-invalid': hasError,
|
|
421
715
|
'aria-required': isRequired,
|
|
@@ -423,15 +717,57 @@ function (_React$Component) {
|
|
|
423
717
|
'aria-describedby': description ? this.descriptionID : undefined
|
|
424
718
|
};
|
|
425
719
|
var resinTargetAttr = resinTarget ? _defineProperty({}, RESIN_TAG_TARGET, resinTarget) : {};
|
|
426
|
-
var valueAttr
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
720
|
+
var valueAttr;
|
|
721
|
+
|
|
722
|
+
if (isAccessible) {
|
|
723
|
+
valueAttr = {
|
|
724
|
+
defaultValue: this.formatDisplayDateType(value)
|
|
725
|
+
};
|
|
726
|
+
} else if (isTextInputAllowed) {
|
|
727
|
+
valueAttr = {
|
|
728
|
+
defaultValue: this.formatDisplay(value)
|
|
729
|
+
};
|
|
730
|
+
} else {
|
|
731
|
+
valueAttr = {
|
|
732
|
+
value: this.formatDisplay(value)
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
var onChangeAttr;
|
|
737
|
+
|
|
738
|
+
if (isAccessible && this.canUseDateInputType) {
|
|
739
|
+
onChangeAttr = {
|
|
740
|
+
onChange: this.handleOnChange
|
|
741
|
+
};
|
|
742
|
+
} else if (isTextInputAllowed || isAccessible && !this.canUseDateInputType) {
|
|
743
|
+
onChangeAttr = {};
|
|
744
|
+
} else {
|
|
745
|
+
// Fixes prop type error about read-only field
|
|
746
|
+
// Not adding readOnly so constraint validation works
|
|
747
|
+
onChangeAttr = {
|
|
748
|
+
onChange: noop
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
var additionalAttrs;
|
|
753
|
+
|
|
754
|
+
if (isAccessible && this.canUseDateInputType) {
|
|
755
|
+
additionalAttrs = {
|
|
756
|
+
max: this.formatDisplayDateType(maxDate) || '9999-12-31',
|
|
757
|
+
min: this.formatDisplayDateType(minDate) || '0001-01-01'
|
|
758
|
+
};
|
|
759
|
+
} else if (isAccessible && !this.canUseDateInputType) {
|
|
760
|
+
// "name" prop is required for pattern validation to be surfaced on form submit. See components/form-elements/form/Form.js
|
|
761
|
+
// "title" prop is shown during constraint validation as a description of the pattern
|
|
762
|
+
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern#usability
|
|
763
|
+
additionalAttrs = {
|
|
764
|
+
name: name,
|
|
765
|
+
pattern: ISO_DATE_FORMAT_PATTERN.source,
|
|
766
|
+
title: 'YYYY-MM-DD'
|
|
767
|
+
};
|
|
768
|
+
} else {
|
|
769
|
+
additionalAttrs = {};
|
|
770
|
+
}
|
|
435
771
|
|
|
436
772
|
return React.createElement("div", {
|
|
437
773
|
className: classes
|
|
@@ -446,59 +782,43 @@ function (_React$Component) {
|
|
|
446
782
|
className: "date-picker-description"
|
|
447
783
|
}, description), React.createElement(Tooltip, {
|
|
448
784
|
className: "date-picker-error-tooltip",
|
|
449
|
-
isShown: !!
|
|
785
|
+
isShown: !!errorMessage,
|
|
450
786
|
position: errorTooltipPosition,
|
|
451
|
-
text:
|
|
787
|
+
text: errorMessage || '',
|
|
452
788
|
theme: TooltipTheme.ERROR
|
|
453
789
|
}, customInput ? React.cloneElement(customInput, _objectSpread({
|
|
454
790
|
disabled: isDisabled,
|
|
455
|
-
ref: function ref(
|
|
456
|
-
_this2.dateInputEl =
|
|
791
|
+
ref: function ref(_ref3) {
|
|
792
|
+
_this2.dateInputEl = _ref3;
|
|
457
793
|
},
|
|
458
794
|
required: isRequired
|
|
459
795
|
}, resinTargetAttr, {}, ariaAttrs)) : React.createElement("input", _extends({
|
|
460
|
-
ref: function ref(
|
|
461
|
-
_this2.dateInputEl =
|
|
796
|
+
ref: function ref(_ref4) {
|
|
797
|
+
_this2.dateInputEl = _ref4;
|
|
462
798
|
},
|
|
463
799
|
className: "date-picker-input",
|
|
464
800
|
disabled: isDisabled,
|
|
465
801
|
onBlur: this.handleInputBlur,
|
|
802
|
+
onClick: this.handleOnClick,
|
|
466
803
|
placeholder: placeholder || formatMessage(messages.chooseDate),
|
|
467
804
|
required: isRequired,
|
|
468
|
-
type:
|
|
805
|
+
type: isAccessible && this.canUseDateInputType ? 'date' : 'text'
|
|
469
806
|
}, onChangeAttr, {
|
|
470
807
|
onFocus: onFocus,
|
|
471
808
|
onKeyDown: this.handleInputKeyDown
|
|
472
|
-
}, resinTargetAttr, ariaAttrs, inputProps, valueAttr))), React.createElement("span", {
|
|
809
|
+
}, resinTargetAttr, ariaAttrs, inputProps, valueAttr, additionalAttrs))), React.createElement("span", {
|
|
473
810
|
id: this.errorMessageID,
|
|
474
811
|
className: "accessibility-hidden",
|
|
475
812
|
role: "alert"
|
|
476
|
-
},
|
|
813
|
+
}, errorMessage))), isClearable && hasValue && !isDisabled ? React.createElement(PlainButton, {
|
|
477
814
|
"aria-label": formatMessage(messages.dateClearButton),
|
|
478
815
|
className: "date-picker-clear-btn",
|
|
479
816
|
onClick: this.clearDate,
|
|
480
817
|
type: ButtonType.BUTTON
|
|
481
|
-
}, React.createElement(
|
|
482
|
-
height: 12,
|
|
483
|
-
width: 12
|
|
484
|
-
})) : null, error ? React.createElement(IconAlert, {
|
|
818
|
+
}, React.createElement(ClearBadge16, null)) : null, hasError ? React.createElement(Alert16, {
|
|
485
819
|
className: "date-picker-icon-alert",
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
width: 13
|
|
489
|
-
}) : null, !isAlwaysVisible && React.createElement(PlainButton, {
|
|
490
|
-
"aria-label": formatMessage(messages.chooseDate),
|
|
491
|
-
className: "date-picker-open-btn",
|
|
492
|
-
getDOMRef: function getDOMRef(ref) {
|
|
493
|
-
_this2.datePickerButtonEl = ref;
|
|
494
|
-
},
|
|
495
|
-
isDisabled: isDisabled,
|
|
496
|
-
onClick: this.handleButtonClick,
|
|
497
|
-
type: ButtonType.BUTTON
|
|
498
|
-
}, React.createElement(IconCalendar, {
|
|
499
|
-
height: 17,
|
|
500
|
-
width: 16
|
|
501
|
-
})), React.createElement("input", {
|
|
820
|
+
title: React.createElement(FormattedMessage, messages.iconAlertText)
|
|
821
|
+
}) : null, this.renderCalendarButton(), React.createElement("input", {
|
|
502
822
|
className: "date-picker-unix-time-input",
|
|
503
823
|
name: name,
|
|
504
824
|
readOnly: true,
|