@ringcentral/juno 1.12.4-beta.5873-31100a7c → 1.12.5-beta.5896-ded29c04
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/components/Dialog/Dialog.js +3 -1
- package/components/Downshift/Downshift.d.ts +1 -1
- package/components/Downshift/Downshift.js +1 -2
- package/components/Downshift/SuggestionList/SuggestionList.js +4 -5
- package/components/Downshift/SuggestionList/utils/useSuggestionList.d.ts +20 -7
- package/components/Downshift/SuggestionList/utils/useSuggestionList.js +88 -70
- package/components/Downshift/utils/DownshiftUtils.d.ts +2 -0
- package/components/Downshift/utils/DownshiftUtils.js +6 -0
- package/components/Downshift/utils/SelectItem.d.ts +3 -1
- package/components/Downshift/utils/index.d.ts +2 -0
- package/components/Downshift/utils/index.js +2 -0
- package/components/Downshift/utils/useDownshift.d.ts +13 -272
- package/components/Downshift/utils/useDownshift.js +132 -429
- package/components/Downshift/utils/useDownshiftGroup.js +1 -0
- package/components/Downshift/utils/useDownshiftTag.d.ts +554 -0
- package/components/Downshift/utils/useDownshiftTag.js +229 -0
- package/components/Forms/TextField/styles/OutlineTextFieldStyle.js +2 -2
- package/components/Forms/TextField/utils/OutlineTextFieldUtils.d.ts +1 -0
- package/components/Forms/TextField/utils/OutlineTextFieldUtils.js +3 -0
- package/components/Forms/Textarea/Textarea.d.ts +2 -2
- package/components/Icon/assets/icon-0.svg +2 -2
- package/components/Icon/assets/icon-2.svg +2 -2
- package/components/Icon/assets/icon-3.svg +2 -2
- package/components/Icon/assets/icon-4.svg +2 -2
- package/components/Icon/assets/icon-5.svg +2 -2
- package/components/Icon/assets/icon-6.svg +2 -2
- package/components/Icon/assets/icon-7.svg +2 -2
- package/components/Icon/assets/icon-8.svg +2 -2
- package/components/Icon/assets/icon-9.svg +2 -2
- package/components/Icon/assets/icon-Announcement.svg +8 -0
- package/components/Icon/assets/icon-Call-queue.svg +14 -0
- package/components/Icon/assets/icon-Limited.svg +7 -0
- package/components/Icon/assets/icon-Message.svg +6 -0
- package/components/Icon/assets/icon-Paging.svg +6 -0
- package/components/Icon/assets/icon-Shared-line.svg +8 -0
- package/components/Icon/assets/icon-avatar_rooms.svg +5 -0
- package/components/Icon/assets/icon-box.svg +1 -1
- package/components/Icon/assets/icon-box1.svg +5 -0
- package/components/Icon/assets/icon-default-file-D.svg +3 -3
- package/components/Icon/assets/icon-default-file.svg +4 -4
- package/components/Icon/assets/icon-default-gdrive-D.svg +4 -4
- package/components/Icon/assets/icon-default-gdrive.svg +5 -5
- package/components/Icon/assets/icon-default-music-D.svg +3 -3
- package/components/Icon/assets/icon-default-music.svg +3 -3
- package/components/Icon/assets/icon-default-video-D.svg +3 -3
- package/components/Icon/assets/icon-default-video.svg +3 -3
- package/components/Icon/assets/icon-deleted_file.svg +2 -2
- package/components/Icon/assets/icon-deleted_file_D.svg +2 -2
- package/components/Icon/assets/icon-doc-D.svg +3 -3
- package/components/Icon/assets/icon-doc.svg +3 -3
- package/components/Icon/assets/icon-end--answer.svg +2 -2
- package/components/Icon/assets/icon-excel-D.svg +3 -3
- package/components/Icon/assets/icon-excel.svg +3 -3
- package/components/Icon/assets/icon-font-color.svg +2 -2
- package/components/Icon/assets/icon-gdrive-logo.svg +6 -6
- package/components/Icon/assets/icon-gif-file-D.svg +3 -3
- package/components/Icon/assets/icon-gif-file.svg +4 -4
- package/components/Icon/assets/icon-gmail.svg +5 -5
- package/components/Icon/assets/icon-google-calendar-2019.svg +6 -6
- package/components/Icon/assets/icon-google-doc-D.svg +3 -3
- package/components/Icon/assets/icon-google-doc.svg +3 -3
- package/components/Icon/assets/icon-google-logo.svg +4 -4
- package/components/Icon/assets/icon-google-sheet-D.svg +3 -3
- package/components/Icon/assets/icon-google-sheet.svg +3 -3
- package/components/Icon/assets/icon-google-slide-D.svg +3 -3
- package/components/Icon/assets/icon-google-slide.svg +3 -3
- package/components/Icon/assets/icon-hold-answer.svg +2 -2
- package/components/Icon/assets/icon-image-broken-D.svg +3 -3
- package/components/Icon/assets/icon-image-broken.svg +4 -4
- package/components/Icon/assets/icon-image-preview-D.svg +3 -3
- package/components/Icon/assets/icon-image-preview.svg +3 -3
- package/components/Icon/assets/icon-item-list-selected.svg +1 -1
- package/components/Icon/assets/icon-mac-keynote-D.svg +3 -3
- package/components/Icon/assets/icon-mac-keynote.svg +6 -6
- package/components/Icon/assets/icon-mac-numbers-D.svg +3 -3
- package/components/Icon/assets/icon-mac-numbers.svg +3 -3
- package/components/Icon/assets/icon-mac-pages-D.svg +3 -3
- package/components/Icon/assets/icon-mac-pages.svg +3 -3
- package/components/Icon/assets/icon-marker_m.svg +2 -2
- package/components/Icon/assets/icon-marker_s.svg +2 -2
- package/components/Icon/assets/icon-microsoft-logo.svg +4 -4
- package/components/Icon/assets/icon-microsoft-outlook-2019.svg +15 -15
- package/components/Icon/assets/icon-mobile.svg +5 -0
- package/components/Icon/assets/icon-no-connection.svg +2 -2
- package/components/Icon/assets/icon-pdf-D.svg +3 -3
- package/components/Icon/assets/icon-pdf.svg +3 -3
- package/components/Icon/assets/icon-poor-connection.svg +2 -2
- package/components/Icon/assets/icon-ppt-D.svg +3 -3
- package/components/Icon/assets/icon-ppt.svg +3 -3
- package/components/Icon/assets/icon-rc_contact.svg +1 -1
- package/components/Icon/assets/icon-rcv_mic-off.svg +2 -2
- package/components/Icon/assets/icon-rcv_videocam-off.svg +2 -2
- package/components/Icon/assets/icon-sort.svg +2 -2
- package/components/Icon/assets/icon-stop-record.svg +1 -1
- package/components/Icon/assets/icon-weak-connection.svg +2 -2
- package/components/Icon/assets/icon-zip-D.svg +3 -3
- package/components/Icon/assets/icon-zip.svg +3 -3
- package/components/Icon/icon-symbol.d.ts +1 -1
- package/components/Icon/icon-symbol.js +1 -1
- package/es6/components/Dialog/Dialog.js +3 -1
- package/es6/components/Downshift/Downshift.js +1 -2
- package/es6/components/Downshift/SuggestionList/SuggestionList.js +4 -5
- package/es6/components/Downshift/SuggestionList/utils/useSuggestionList.js +90 -72
- package/es6/components/Downshift/utils/DownshiftUtils.js +5 -0
- package/es6/components/Downshift/utils/index.js +2 -0
- package/es6/components/Downshift/utils/useDownshift.js +135 -432
- package/es6/components/Downshift/utils/useDownshiftGroup.js +1 -0
- package/es6/components/Downshift/utils/useDownshiftTag.js +227 -0
- package/es6/components/Forms/TextField/styles/OutlineTextFieldStyle.js +2 -2
- package/es6/components/Forms/TextField/utils/OutlineTextFieldUtils.js +3 -0
- package/es6/components/Icon/assets/icon-0.svg +2 -2
- package/es6/components/Icon/assets/icon-2.svg +2 -2
- package/es6/components/Icon/assets/icon-3.svg +2 -2
- package/es6/components/Icon/assets/icon-4.svg +2 -2
- package/es6/components/Icon/assets/icon-5.svg +2 -2
- package/es6/components/Icon/assets/icon-6.svg +2 -2
- package/es6/components/Icon/assets/icon-7.svg +2 -2
- package/es6/components/Icon/assets/icon-8.svg +2 -2
- package/es6/components/Icon/assets/icon-9.svg +2 -2
- package/es6/components/Icon/assets/icon-Announcement.svg +8 -0
- package/es6/components/Icon/assets/icon-Call-queue.svg +14 -0
- package/es6/components/Icon/assets/icon-Limited.svg +7 -0
- package/es6/components/Icon/assets/icon-Message.svg +6 -0
- package/es6/components/Icon/assets/icon-Paging.svg +6 -0
- package/es6/components/Icon/assets/icon-Shared-line.svg +8 -0
- package/es6/components/Icon/assets/icon-avatar_rooms.svg +5 -0
- package/es6/components/Icon/assets/icon-box.svg +1 -1
- package/es6/components/Icon/assets/icon-box1.svg +5 -0
- package/es6/components/Icon/assets/icon-default-file-D.svg +3 -3
- package/es6/components/Icon/assets/icon-default-file.svg +4 -4
- package/es6/components/Icon/assets/icon-default-gdrive-D.svg +4 -4
- package/es6/components/Icon/assets/icon-default-gdrive.svg +5 -5
- package/es6/components/Icon/assets/icon-default-music-D.svg +3 -3
- package/es6/components/Icon/assets/icon-default-music.svg +3 -3
- package/es6/components/Icon/assets/icon-default-video-D.svg +3 -3
- package/es6/components/Icon/assets/icon-default-video.svg +3 -3
- package/es6/components/Icon/assets/icon-deleted_file.svg +2 -2
- package/es6/components/Icon/assets/icon-deleted_file_D.svg +2 -2
- package/es6/components/Icon/assets/icon-doc-D.svg +3 -3
- package/es6/components/Icon/assets/icon-doc.svg +3 -3
- package/es6/components/Icon/assets/icon-end--answer.svg +2 -2
- package/es6/components/Icon/assets/icon-excel-D.svg +3 -3
- package/es6/components/Icon/assets/icon-excel.svg +3 -3
- package/es6/components/Icon/assets/icon-font-color.svg +2 -2
- package/es6/components/Icon/assets/icon-gdrive-logo.svg +6 -6
- package/es6/components/Icon/assets/icon-gif-file-D.svg +3 -3
- package/es6/components/Icon/assets/icon-gif-file.svg +4 -4
- package/es6/components/Icon/assets/icon-gmail.svg +5 -5
- package/es6/components/Icon/assets/icon-google-calendar-2019.svg +6 -6
- package/es6/components/Icon/assets/icon-google-doc-D.svg +3 -3
- package/es6/components/Icon/assets/icon-google-doc.svg +3 -3
- package/es6/components/Icon/assets/icon-google-logo.svg +4 -4
- package/es6/components/Icon/assets/icon-google-sheet-D.svg +3 -3
- package/es6/components/Icon/assets/icon-google-sheet.svg +3 -3
- package/es6/components/Icon/assets/icon-google-slide-D.svg +3 -3
- package/es6/components/Icon/assets/icon-google-slide.svg +3 -3
- package/es6/components/Icon/assets/icon-hold-answer.svg +2 -2
- package/es6/components/Icon/assets/icon-image-broken-D.svg +3 -3
- package/es6/components/Icon/assets/icon-image-broken.svg +4 -4
- package/es6/components/Icon/assets/icon-image-preview-D.svg +3 -3
- package/es6/components/Icon/assets/icon-image-preview.svg +3 -3
- package/es6/components/Icon/assets/icon-item-list-selected.svg +1 -1
- package/es6/components/Icon/assets/icon-mac-keynote-D.svg +3 -3
- package/es6/components/Icon/assets/icon-mac-keynote.svg +6 -6
- package/es6/components/Icon/assets/icon-mac-numbers-D.svg +3 -3
- package/es6/components/Icon/assets/icon-mac-numbers.svg +3 -3
- package/es6/components/Icon/assets/icon-mac-pages-D.svg +3 -3
- package/es6/components/Icon/assets/icon-mac-pages.svg +3 -3
- package/es6/components/Icon/assets/icon-marker_m.svg +2 -2
- package/es6/components/Icon/assets/icon-marker_s.svg +2 -2
- package/es6/components/Icon/assets/icon-microsoft-logo.svg +4 -4
- package/es6/components/Icon/assets/icon-microsoft-outlook-2019.svg +15 -15
- package/es6/components/Icon/assets/icon-mobile.svg +5 -0
- package/es6/components/Icon/assets/icon-no-connection.svg +2 -2
- package/es6/components/Icon/assets/icon-pdf-D.svg +3 -3
- package/es6/components/Icon/assets/icon-pdf.svg +3 -3
- package/es6/components/Icon/assets/icon-poor-connection.svg +2 -2
- package/es6/components/Icon/assets/icon-ppt-D.svg +3 -3
- package/es6/components/Icon/assets/icon-ppt.svg +3 -3
- package/es6/components/Icon/assets/icon-rc_contact.svg +1 -1
- package/es6/components/Icon/assets/icon-rcv_mic-off.svg +2 -2
- package/es6/components/Icon/assets/icon-rcv_videocam-off.svg +2 -2
- package/es6/components/Icon/assets/icon-sort.svg +2 -2
- package/es6/components/Icon/assets/icon-stop-record.svg +1 -1
- package/es6/components/Icon/assets/icon-weak-connection.svg +2 -2
- package/es6/components/Icon/assets/icon-zip-D.svg +3 -3
- package/es6/components/Icon/assets/icon-zip.svg +3 -3
- package/es6/components/Icon/icon-symbol.js +1 -1
- package/es6/foundation/hooks/useRefState/useRefState.js +6 -1
- package/es6/foundation/theme/ThemeProvider.js +22 -6
- package/es6/icon/0.js +2 -2
- package/es6/icon/2.js +2 -2
- package/es6/icon/3.js +2 -2
- package/es6/icon/4.js +2 -2
- package/es6/icon/5.js +2 -2
- package/es6/icon/6.js +2 -2
- package/es6/icon/7.js +2 -2
- package/es6/icon/8.js +2 -2
- package/es6/icon/9.js +2 -2
- package/es6/icon/Announcement.js +8 -0
- package/es6/icon/AvatarRooms.js +7 -0
- package/es6/icon/Box.js +1 -1
- package/es6/icon/Box1.js +7 -0
- package/es6/icon/CallQueue.js +14 -0
- package/es6/icon/DefaultFile.js +4 -4
- package/es6/icon/DefaultFileD.js +3 -3
- package/es6/icon/DefaultGdrive.js +5 -5
- package/es6/icon/DefaultGdriveD.js +4 -4
- package/es6/icon/DefaultMusic.js +3 -3
- package/es6/icon/DefaultMusicD.js +3 -3
- package/es6/icon/DefaultVideo.js +3 -3
- package/es6/icon/DefaultVideoD.js +3 -3
- package/es6/icon/DeletedFile.js +2 -2
- package/es6/icon/DeletedFileD.js +2 -2
- package/es6/icon/Doc.js +3 -3
- package/es6/icon/DocD.js +3 -3
- package/es6/icon/EndAnswer.js +2 -2
- package/es6/icon/Excel.js +3 -3
- package/es6/icon/ExcelD.js +3 -3
- package/es6/icon/FontColor.js +2 -2
- package/es6/icon/GdriveLogo.js +6 -6
- package/es6/icon/GifFile.js +4 -4
- package/es6/icon/GifFileD.js +3 -3
- package/es6/icon/Gmail.js +5 -5
- package/es6/icon/GoogleCalendar2019.js +6 -6
- package/es6/icon/GoogleDoc.js +3 -3
- package/es6/icon/GoogleDocD.js +3 -3
- package/es6/icon/GoogleLogo.js +4 -4
- package/es6/icon/GoogleSheet.js +3 -3
- package/es6/icon/GoogleSheetD.js +3 -3
- package/es6/icon/GoogleSlide.js +3 -3
- package/es6/icon/GoogleSlideD.js +3 -3
- package/es6/icon/HoldAnswer.js +2 -2
- package/es6/icon/ImageBroken.js +4 -4
- package/es6/icon/ImageBrokenD.js +3 -3
- package/es6/icon/ImagePreview.js +3 -3
- package/es6/icon/ImagePreviewD.js +3 -3
- package/es6/icon/ItemListSelected.js +1 -1
- package/es6/icon/Limited.js +8 -0
- package/es6/icon/MacKeynote.js +4 -4
- package/es6/icon/MacKeynoteD.js +3 -3
- package/es6/icon/MacNumbers.js +3 -3
- package/es6/icon/MacNumbersD.js +3 -3
- package/es6/icon/MacPages.js +3 -3
- package/es6/icon/MacPagesD.js +3 -3
- package/es6/icon/MarkerM.js +2 -2
- package/es6/icon/MarkerS.js +2 -2
- package/es6/icon/Message.js +8 -0
- package/es6/icon/MicrosoftLogo.js +4 -4
- package/es6/icon/MicrosoftOutlook2019.js +15 -15
- package/es6/icon/Mobile.js +7 -0
- package/es6/icon/NoConnection.js +2 -2
- package/es6/icon/Paging.js +8 -0
- package/es6/icon/Pdf.js +3 -3
- package/es6/icon/PdfD.js +3 -3
- package/es6/icon/PoorConnection.js +2 -2
- package/es6/icon/Ppt.js +3 -3
- package/es6/icon/PptD.js +3 -3
- package/es6/icon/RcContact.js +1 -1
- package/es6/icon/RcvMicOff.js +2 -2
- package/es6/icon/RcvVideocamOff.js +2 -2
- package/es6/icon/SharedLine.js +9 -0
- package/es6/icon/Sort.js +2 -2
- package/es6/icon/StopRecord.js +1 -1
- package/es6/icon/WeakConnection.js +2 -2
- package/es6/icon/Zip.js +3 -3
- package/es6/icon/ZipD.js +3 -3
- package/es6/icon/index.js +10 -1
- package/es6/icons/icon-0.svg +2 -2
- package/es6/icons/icon-2.svg +2 -2
- package/es6/icons/icon-3.svg +2 -2
- package/es6/icons/icon-4.svg +2 -2
- package/es6/icons/icon-5.svg +2 -2
- package/es6/icons/icon-6.svg +2 -2
- package/es6/icons/icon-7.svg +2 -2
- package/es6/icons/icon-8.svg +2 -2
- package/es6/icons/icon-9.svg +2 -2
- package/es6/icons/icon-Announcement.svg +8 -0
- package/es6/icons/icon-Call-queue.svg +14 -0
- package/es6/icons/icon-Limited.svg +7 -0
- package/es6/icons/icon-Message.svg +6 -0
- package/es6/icons/icon-Paging.svg +6 -0
- package/es6/icons/icon-Shared-line.svg +8 -0
- package/es6/icons/icon-avatar_rooms.svg +5 -0
- package/es6/icons/icon-box.svg +1 -1
- package/es6/icons/icon-box1.svg +5 -0
- package/es6/icons/icon-default-file-D.svg +3 -3
- package/es6/icons/icon-default-file.svg +4 -4
- package/es6/icons/icon-default-gdrive-D.svg +4 -4
- package/es6/icons/icon-default-gdrive.svg +5 -5
- package/es6/icons/icon-default-music-D.svg +3 -3
- package/es6/icons/icon-default-music.svg +3 -3
- package/es6/icons/icon-default-video-D.svg +3 -3
- package/es6/icons/icon-default-video.svg +3 -3
- package/es6/icons/icon-deleted_file.svg +2 -2
- package/es6/icons/icon-deleted_file_D.svg +2 -2
- package/es6/icons/icon-doc-D.svg +3 -3
- package/es6/icons/icon-doc.svg +3 -3
- package/es6/icons/icon-end--answer.svg +2 -2
- package/es6/icons/icon-excel-D.svg +3 -3
- package/es6/icons/icon-excel.svg +3 -3
- package/es6/icons/icon-font-color.svg +2 -2
- package/es6/icons/icon-gdrive-logo.svg +6 -6
- package/es6/icons/icon-gif-file-D.svg +3 -3
- package/es6/icons/icon-gif-file.svg +4 -4
- package/es6/icons/icon-gmail.svg +5 -5
- package/es6/icons/icon-google-calendar-2019.svg +6 -6
- package/es6/icons/icon-google-doc-D.svg +3 -3
- package/es6/icons/icon-google-doc.svg +3 -3
- package/es6/icons/icon-google-logo.svg +4 -4
- package/es6/icons/icon-google-sheet-D.svg +3 -3
- package/es6/icons/icon-google-sheet.svg +3 -3
- package/es6/icons/icon-google-slide-D.svg +3 -3
- package/es6/icons/icon-google-slide.svg +3 -3
- package/es6/icons/icon-hold-answer.svg +2 -2
- package/es6/icons/icon-image-broken-D.svg +3 -3
- package/es6/icons/icon-image-broken.svg +4 -4
- package/es6/icons/icon-image-preview-D.svg +3 -3
- package/es6/icons/icon-image-preview.svg +3 -3
- package/es6/icons/icon-item-list-selected.svg +1 -1
- package/es6/icons/icon-mac-keynote-D.svg +3 -3
- package/es6/icons/icon-mac-keynote.svg +6 -6
- package/es6/icons/icon-mac-numbers-D.svg +3 -3
- package/es6/icons/icon-mac-numbers.svg +3 -3
- package/es6/icons/icon-mac-pages-D.svg +3 -3
- package/es6/icons/icon-mac-pages.svg +3 -3
- package/es6/icons/icon-marker_m.svg +2 -2
- package/es6/icons/icon-marker_s.svg +2 -2
- package/es6/icons/icon-microsoft-logo.svg +4 -4
- package/es6/icons/icon-microsoft-outlook-2019.svg +15 -15
- package/es6/icons/icon-mobile.svg +5 -0
- package/es6/icons/icon-no-connection.svg +2 -2
- package/es6/icons/icon-pdf-D.svg +3 -3
- package/es6/icons/icon-pdf.svg +3 -3
- package/es6/icons/icon-poor-connection.svg +2 -2
- package/es6/icons/icon-ppt-D.svg +3 -3
- package/es6/icons/icon-ppt.svg +3 -3
- package/es6/icons/icon-rc_contact.svg +1 -1
- package/es6/icons/icon-rcv_mic-off.svg +2 -2
- package/es6/icons/icon-rcv_videocam-off.svg +2 -2
- package/es6/icons/icon-sort.svg +2 -2
- package/es6/icons/icon-stop-record.svg +1 -1
- package/es6/icons/icon-weak-connection.svg +2 -2
- package/es6/icons/icon-zip-D.svg +3 -3
- package/es6/icons/icon-zip.svg +3 -3
- package/foundation/hooks/useRefState/useRefState.js +6 -1
- package/foundation/theme/ThemeProvider.d.ts +11 -11
- package/foundation/theme/ThemeProvider.js +22 -6
- package/icon/0.js +2 -2
- package/icon/2.js +2 -2
- package/icon/3.js +2 -2
- package/icon/4.js +2 -2
- package/icon/5.js +2 -2
- package/icon/6.js +2 -2
- package/icon/7.js +2 -2
- package/icon/8.js +2 -2
- package/icon/9.js +2 -2
- package/icon/Announcement.d.ts +3 -0
- package/icon/Announcement.js +10 -0
- package/icon/AvatarRooms.d.ts +3 -0
- package/icon/AvatarRooms.js +9 -0
- package/icon/Box.js +1 -1
- package/icon/Box1.d.ts +3 -0
- package/icon/Box1.js +9 -0
- package/icon/CallQueue.d.ts +3 -0
- package/icon/CallQueue.js +16 -0
- package/icon/DefaultFile.js +4 -4
- package/icon/DefaultFileD.js +3 -3
- package/icon/DefaultGdrive.js +5 -5
- package/icon/DefaultGdriveD.js +4 -4
- package/icon/DefaultMusic.js +3 -3
- package/icon/DefaultMusicD.js +3 -3
- package/icon/DefaultVideo.js +3 -3
- package/icon/DefaultVideoD.js +3 -3
- package/icon/DeletedFile.js +2 -2
- package/icon/DeletedFileD.js +2 -2
- package/icon/Doc.js +3 -3
- package/icon/DocD.js +3 -3
- package/icon/EndAnswer.js +2 -2
- package/icon/Excel.js +3 -3
- package/icon/ExcelD.js +3 -3
- package/icon/FontColor.js +2 -2
- package/icon/GdriveLogo.js +6 -6
- package/icon/GifFile.js +4 -4
- package/icon/GifFileD.js +3 -3
- package/icon/Gmail.js +5 -5
- package/icon/GoogleCalendar2019.js +6 -6
- package/icon/GoogleDoc.js +3 -3
- package/icon/GoogleDocD.js +3 -3
- package/icon/GoogleLogo.js +4 -4
- package/icon/GoogleSheet.js +3 -3
- package/icon/GoogleSheetD.js +3 -3
- package/icon/GoogleSlide.js +3 -3
- package/icon/GoogleSlideD.js +3 -3
- package/icon/HoldAnswer.js +2 -2
- package/icon/ImageBroken.js +4 -4
- package/icon/ImageBrokenD.js +3 -3
- package/icon/ImagePreview.js +3 -3
- package/icon/ImagePreviewD.js +3 -3
- package/icon/ItemListSelected.js +1 -1
- package/icon/Limited.d.ts +3 -0
- package/icon/Limited.js +10 -0
- package/icon/MacKeynote.js +4 -4
- package/icon/MacKeynoteD.js +3 -3
- package/icon/MacNumbers.js +3 -3
- package/icon/MacNumbersD.js +3 -3
- package/icon/MacPages.js +3 -3
- package/icon/MacPagesD.js +3 -3
- package/icon/MarkerM.js +2 -2
- package/icon/MarkerS.js +2 -2
- package/icon/Message.d.ts +3 -0
- package/icon/Message.js +10 -0
- package/icon/MicrosoftLogo.js +4 -4
- package/icon/MicrosoftOutlook2019.js +15 -15
- package/icon/Mobile.d.ts +3 -0
- package/icon/Mobile.js +9 -0
- package/icon/NoConnection.js +2 -2
- package/icon/Paging.d.ts +3 -0
- package/icon/Paging.js +10 -0
- package/icon/Pdf.js +3 -3
- package/icon/PdfD.js +3 -3
- package/icon/PoorConnection.js +2 -2
- package/icon/Ppt.js +3 -3
- package/icon/PptD.js +3 -3
- package/icon/RcContact.js +1 -1
- package/icon/RcvMicOff.js +2 -2
- package/icon/RcvVideocamOff.js +2 -2
- package/icon/SharedLine.d.ts +3 -0
- package/icon/SharedLine.js +11 -0
- package/icon/Sort.js +2 -2
- package/icon/StopRecord.js +1 -1
- package/icon/WeakConnection.js +2 -2
- package/icon/Zip.js +3 -3
- package/icon/ZipD.js +3 -3
- package/icon/index.d.ts +10 -1
- package/icon/index.js +20 -2
- package/icons/icon-0.svg +2 -2
- package/icons/icon-2.svg +2 -2
- package/icons/icon-3.svg +2 -2
- package/icons/icon-4.svg +2 -2
- package/icons/icon-5.svg +2 -2
- package/icons/icon-6.svg +2 -2
- package/icons/icon-7.svg +2 -2
- package/icons/icon-8.svg +2 -2
- package/icons/icon-9.svg +2 -2
- package/icons/icon-Announcement.svg +8 -0
- package/icons/icon-Call-queue.svg +14 -0
- package/icons/icon-Limited.svg +7 -0
- package/icons/icon-Message.svg +6 -0
- package/icons/icon-Paging.svg +6 -0
- package/icons/icon-Shared-line.svg +8 -0
- package/icons/icon-avatar_rooms.svg +5 -0
- package/icons/icon-box.svg +1 -1
- package/icons/icon-box1.svg +5 -0
- package/icons/icon-default-file-D.svg +3 -3
- package/icons/icon-default-file.svg +4 -4
- package/icons/icon-default-gdrive-D.svg +4 -4
- package/icons/icon-default-gdrive.svg +5 -5
- package/icons/icon-default-music-D.svg +3 -3
- package/icons/icon-default-music.svg +3 -3
- package/icons/icon-default-video-D.svg +3 -3
- package/icons/icon-default-video.svg +3 -3
- package/icons/icon-deleted_file.svg +2 -2
- package/icons/icon-deleted_file_D.svg +2 -2
- package/icons/icon-doc-D.svg +3 -3
- package/icons/icon-doc.svg +3 -3
- package/icons/icon-end--answer.svg +2 -2
- package/icons/icon-excel-D.svg +3 -3
- package/icons/icon-excel.svg +3 -3
- package/icons/icon-font-color.svg +2 -2
- package/icons/icon-gdrive-logo.svg +6 -6
- package/icons/icon-gif-file-D.svg +3 -3
- package/icons/icon-gif-file.svg +4 -4
- package/icons/icon-gmail.svg +5 -5
- package/icons/icon-google-calendar-2019.svg +6 -6
- package/icons/icon-google-doc-D.svg +3 -3
- package/icons/icon-google-doc.svg +3 -3
- package/icons/icon-google-logo.svg +4 -4
- package/icons/icon-google-sheet-D.svg +3 -3
- package/icons/icon-google-sheet.svg +3 -3
- package/icons/icon-google-slide-D.svg +3 -3
- package/icons/icon-google-slide.svg +3 -3
- package/icons/icon-hold-answer.svg +2 -2
- package/icons/icon-image-broken-D.svg +3 -3
- package/icons/icon-image-broken.svg +4 -4
- package/icons/icon-image-preview-D.svg +3 -3
- package/icons/icon-image-preview.svg +3 -3
- package/icons/icon-item-list-selected.svg +1 -1
- package/icons/icon-mac-keynote-D.svg +3 -3
- package/icons/icon-mac-keynote.svg +6 -6
- package/icons/icon-mac-numbers-D.svg +3 -3
- package/icons/icon-mac-numbers.svg +3 -3
- package/icons/icon-mac-pages-D.svg +3 -3
- package/icons/icon-mac-pages.svg +3 -3
- package/icons/icon-marker_m.svg +2 -2
- package/icons/icon-marker_s.svg +2 -2
- package/icons/icon-microsoft-logo.svg +4 -4
- package/icons/icon-microsoft-outlook-2019.svg +15 -15
- package/icons/icon-mobile.svg +5 -0
- package/icons/icon-no-connection.svg +2 -2
- package/icons/icon-pdf-D.svg +3 -3
- package/icons/icon-pdf.svg +3 -3
- package/icons/icon-poor-connection.svg +2 -2
- package/icons/icon-ppt-D.svg +3 -3
- package/icons/icon-ppt.svg +3 -3
- package/icons/icon-rc_contact.svg +1 -1
- package/icons/icon-rcv_mic-off.svg +2 -2
- package/icons/icon-rcv_videocam-off.svg +2 -2
- package/icons/icon-sort.svg +2 -2
- package/icons/icon-stop-record.svg +1 -1
- package/icons/icon-weak-connection.svg +2 -2
- package/icons/icon-zip-D.svg +3 -3
- package/icons/icon-zip.svg +3 -3
- package/package.json +1 -1
|
@@ -1,70 +1,62 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __read,
|
|
2
|
-
import { useLayoutEffect, useMemo, useRef,
|
|
3
|
-
import isString from 'lodash/isString';
|
|
4
|
-
import uniqueId from 'lodash/uniqueId';
|
|
1
|
+
import { __assign, __awaiter, __generator, __read, __spread } from "tslib";
|
|
2
|
+
import { useCallback, useLayoutEffect, useMemo, useRef, } from 'react';
|
|
5
3
|
import { useControlled } from '@material-ui/core/utils';
|
|
6
|
-
import { combineProps, getSelectionPosition, useChange,
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
4
|
+
import { combineProps, getSelectionPosition, useChange, useId, useSleep, } from '../../../foundation';
|
|
5
|
+
import { useSuggestionList } from '../SuggestionList/utils/useSuggestionList';
|
|
6
|
+
import { DEFAULT_GET_OPTION_LABEL, DEFAULT_KEY_TO_CHIPS, downshiftComponentName, stringArrToRegExp, } from './DownshiftUtils';
|
|
7
|
+
import { useDownshiftTag } from './useDownshiftTag';
|
|
10
8
|
var DOWNSHIFT_ID_NO_RESULT_TOKEN = 'rc-chip-empty';
|
|
11
9
|
var DEFAULT_HIGHLIGHTED_INDEX = -1;
|
|
12
|
-
function stringArrToRegExp(keyToTags) {
|
|
13
|
-
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
14
|
-
return new RegExp((keyToTags === null || keyToTags === void 0 ? void 0 : keyToTags.join('|')) || '', 'g');
|
|
15
|
-
}
|
|
16
|
-
var componentName = 'RcDownshift';
|
|
17
10
|
export var useDownshift = function (_a) {
|
|
18
|
-
var multipleProp = _a.multiple, variant = _a.variant, labelProp = _a.label, inputValueProp = _a.inputValue, _b = _a.getOptionLabel, getOptionLabel = _b === void 0 ? DEFAULT_GET_OPTION_LABEL : _b, _c = _a.keyToTags, keyToTags = _c === void 0 ? DEFAULT_KEY_TO_CHIPS : _c,
|
|
11
|
+
var multipleProp = _a.multiple, variant = _a.variant, labelProp = _a.label, inputValueProp = _a.inputValue, _b = _a.getOptionLabel, getOptionLabel = _b === void 0 ? DEFAULT_GET_OPTION_LABEL : _b, _c = _a.keyToTags, keyToTags = _c === void 0 ? DEFAULT_KEY_TO_CHIPS : _c, filterOptionsProp = _a.filterOptions, disabledItemsHighlightable = _a.disabledItemsHighlightable, options = _a.options, freeSolo = _a.freeSolo, onInputChangeProp = _a.onInputChange, maxFreeSolo = _a.maxFreeSolo, onMaxFreeSolo = _a.onMaxFreeSolo, openOnFocus = _a.openOnFocus, disableCloseOnSelect = _a.disableCloseOnSelect, initialIsOpen = _a.initialIsOpen, autoSelect = _a.autoSelect, inputContainerRef = _a.inputContainerRef, inputRef = _a.inputRef, wrapperRef = _a.wrapperRef, onKeyDownProp = _a.onKeyDown, onSelectChange = _a.onChange, _d = _a.value, selectedItemsProp = _d === void 0 ? [] : _d, disabled = _a.disabled, renderNoOptions = _a.renderNoOptions, onClear = _a.onClear, autoHighlight = _a.autoHighlight, getOptionDisabled = _a.getOptionDisabled, addNoOptionItem = _a.addNoOptionItem, groupBy = _a.groupBy, onGroupExpanded = _a.onGroupExpanded, groupVariant = _a.groupVariant, groupExpanded = _a.groupExpanded, groupDefaultExpanded = _a.groupDefaultExpanded, getExpandIconProps = _a.getExpandIconProps, required = _a.required, openProp = _a.open, onOpen = _a.onOpen, onClose = _a.onClose, focused = _a.focused;
|
|
19
12
|
var isAutocomplete = variant === 'autocomplete';
|
|
20
|
-
|
|
21
|
-
var multiple = isAutocomplete ? false : multipleProp;
|
|
22
|
-
var isSelectedFromAutocompleteRef = useRef(false);
|
|
23
|
-
var isInputValueChangedRef = useRef(false);
|
|
13
|
+
var downshiftId = useId('downshift', true);
|
|
24
14
|
var _e = __read(useControlled({
|
|
25
|
-
controlled:
|
|
15
|
+
controlled: focused,
|
|
26
16
|
default: false,
|
|
27
|
-
name:
|
|
28
|
-
}), 2),
|
|
17
|
+
name: downshiftComponentName,
|
|
18
|
+
}), 2), inputFocused = _e[0], setInputFocused = _e[1];
|
|
29
19
|
var _f = __read(useControlled({
|
|
30
20
|
controlled: openProp,
|
|
31
21
|
default: initialIsOpen || false,
|
|
32
|
-
name:
|
|
22
|
+
name: downshiftComponentName,
|
|
33
23
|
}), 2), isOpen = _f[0], setIsOpen = _f[1];
|
|
34
|
-
var
|
|
35
|
-
var _h = __read(useState(0), 2), activeIndex = _h[0], setActiveIndex = _h[1];
|
|
36
|
-
var _j = __read(useControlled({
|
|
37
|
-
controlled: inputValueProp,
|
|
38
|
-
default: '',
|
|
39
|
-
name: componentName,
|
|
40
|
-
}), 2), inputValue = _j[0], setInputValue = _j[1];
|
|
41
|
-
var updateInputValue = function (newValue) {
|
|
42
|
-
onInputChangeProp === null || onInputChangeProp === void 0 ? void 0 : onInputChangeProp(newValue);
|
|
43
|
-
setInputValue(newValue);
|
|
44
|
-
};
|
|
45
|
-
var _k = __read(useControlled({
|
|
46
|
-
controlled: selectedItemsProp,
|
|
47
|
-
default: [],
|
|
48
|
-
name: componentName,
|
|
49
|
-
}), 2), selectedItems = _k[0], setSelectedItems = _k[1];
|
|
50
|
-
var focusInput = function () { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
51
|
-
var downshiftId = useResultRef(function () { return uniqueId("downshift-"); }).current;
|
|
52
|
-
// * use -2 for us know that is init state, for recalculate defaultHighlightedIndex
|
|
53
|
-
var highlightedIndexRef = useRef(DEFAULT_HIGHLIGHTED_INDEX);
|
|
24
|
+
var isInputValueChangedRef = useRef(false);
|
|
54
25
|
var isCompositionRef = useRef(false);
|
|
55
|
-
var noOptionItemRef = useRef();
|
|
26
|
+
var noOptionItemRef = useRef(null);
|
|
56
27
|
var stopAutoSelectRef = useRef(false);
|
|
57
28
|
var fromPasteString = useRef('');
|
|
58
29
|
var keepHighlightedIndexRef = useRef(false);
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
30
|
+
var _g = useSleep(), sleep = _g.sleep, getSleeping = _g.getSleeping;
|
|
31
|
+
// * when that is autocomplete, that will never be multiple
|
|
32
|
+
var multiple = isAutocomplete ? false : multipleProp;
|
|
33
|
+
var _h = useDownshiftTag({
|
|
34
|
+
id: downshiftId,
|
|
35
|
+
value: selectedItemsProp,
|
|
36
|
+
onChange: onSelectChange,
|
|
37
|
+
getOptionLabel: getOptionLabel,
|
|
38
|
+
onInputChange: onInputChangeProp,
|
|
39
|
+
variant: variant,
|
|
40
|
+
wrapperRef: wrapperRef,
|
|
41
|
+
inputRef: inputRef,
|
|
42
|
+
freeSolo: freeSolo,
|
|
43
|
+
maxFreeSolo: maxFreeSolo,
|
|
44
|
+
keyToTags: keyToTags,
|
|
45
|
+
onMaxFreeSolo: onMaxFreeSolo,
|
|
46
|
+
multiple: multiple,
|
|
47
|
+
label: labelProp,
|
|
48
|
+
required: required,
|
|
49
|
+
disabled: disabled,
|
|
50
|
+
// * when is composition, stop freeSolo create new item
|
|
51
|
+
getStopCreateFreeSolo: function () { return isCompositionRef.current; },
|
|
52
|
+
onReset: function () {
|
|
53
|
+
resetState();
|
|
54
|
+
},
|
|
55
|
+
}), isSelectedFromAutocompleteRef = _h.isSelectedFromAutocompleteRef, tags = _h.tags, tagFocused = _h.focused, addTag = _h.addTag, checkAndAddFreeSolo = _h.checkAndAddFreeSolo, focusedTagIndex = _h.focusedIndex, focusTag = _h.focusTag, focusLastTag = _h.focusLast, clearTags = _h.clearTags, blurTags = _h.blur, getTagProps = _h.getTagProps, getTagListBoxProps = _h.getTagListBoxProps;
|
|
56
|
+
var processFilteredResult = useCallback(function (results, inputValue) {
|
|
57
|
+
if (inputValue === void 0) { inputValue = ''; }
|
|
66
58
|
var getInputValueAsItem = function () {
|
|
67
|
-
var label = inputValue.trim()
|
|
59
|
+
var label = inputValue.trim();
|
|
68
60
|
if (label.length > 0) {
|
|
69
61
|
var item = {
|
|
70
62
|
id: DOWNSHIFT_ID_NO_RESULT_TOKEN,
|
|
@@ -74,22 +66,10 @@ export var useDownshift = function (_a) {
|
|
|
74
66
|
};
|
|
75
67
|
return item;
|
|
76
68
|
}
|
|
77
|
-
return
|
|
78
|
-
};
|
|
79
|
-
var getFilteredItems = function (items) {
|
|
80
|
-
if (filterOptions) {
|
|
81
|
-
return filterOptions(items, {
|
|
82
|
-
inputValue: inputValue,
|
|
83
|
-
inputChanged: isInputValueChangedRef.current,
|
|
84
|
-
getOptionLabel: getOptionLabel,
|
|
85
|
-
selectedItems: selectedItems,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return items;
|
|
69
|
+
return null;
|
|
89
70
|
};
|
|
90
71
|
// * only when isOpen calculate the filtered result
|
|
91
|
-
|
|
92
|
-
noOptionItemRef.current = undefined;
|
|
72
|
+
noOptionItemRef.current = null;
|
|
93
73
|
if (addNoOptionItem) {
|
|
94
74
|
var item = getInputValueAsItem();
|
|
95
75
|
noOptionItemRef.current = item;
|
|
@@ -114,68 +94,58 @@ export var useDownshift = function (_a) {
|
|
|
114
94
|
}
|
|
115
95
|
}
|
|
116
96
|
return results;
|
|
117
|
-
}, [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
groupBy: groupBy,
|
|
97
|
+
}, [addNoOptionItem, freeSolo, renderNoOptions]);
|
|
98
|
+
var filterOptions = useCallback(function (items, state) {
|
|
99
|
+
if (filterOptionsProp) {
|
|
100
|
+
return filterOptionsProp(items, __assign(__assign({}, state), { inputChanged: isInputValueChangedRef.current, selectedItems: tags }));
|
|
101
|
+
}
|
|
102
|
+
return items;
|
|
103
|
+
}, [filterOptionsProp, tags]);
|
|
104
|
+
var _j = useSuggestionList({
|
|
105
|
+
id: downshiftId,
|
|
106
|
+
inputRef: inputRef,
|
|
107
|
+
inputValue: inputValueProp,
|
|
129
108
|
options: options,
|
|
130
|
-
|
|
131
|
-
|
|
109
|
+
disabledItemsHighlightable: disabledItemsHighlightable,
|
|
110
|
+
groupVariant: groupVariant,
|
|
132
111
|
groupExpanded: groupExpanded,
|
|
133
112
|
groupDefaultExpanded: groupDefaultExpanded,
|
|
113
|
+
getOptionLabel: getOptionLabel,
|
|
114
|
+
filterOptions: filterOptions,
|
|
115
|
+
processFilteredResult: processFilteredResult,
|
|
116
|
+
onInputChange: onInputChangeProp,
|
|
117
|
+
onKeyDown: onKeyDownProp,
|
|
118
|
+
onClear: onClear,
|
|
119
|
+
getOptionDisabled: getOptionDisabled,
|
|
120
|
+
groupBy: groupBy,
|
|
134
121
|
onGroupExpanded: onGroupExpanded,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
var textFieldElm = wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current;
|
|
163
|
-
var inputElm = inputRef.current;
|
|
164
|
-
if (tagToFocus === -1) {
|
|
165
|
-
inputElm === null || inputElm === void 0 ? void 0 : inputElm.focus();
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
(_a = textFieldElm === null || textFieldElm === void 0 ? void 0 : textFieldElm.querySelector("[data-tag-index=\"" + tagToFocus + "\"]")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
var handleFocusTag = useEventCallback(function (tagToFocus, focus) {
|
|
172
|
-
if (focus === void 0) { focus = true; }
|
|
173
|
-
if (activeIndex === tagToFocus)
|
|
174
|
-
return;
|
|
175
|
-
setActiveIndex(tagToFocus);
|
|
176
|
-
if (focus)
|
|
177
|
-
focusTag(tagToFocus);
|
|
178
|
-
});
|
|
122
|
+
getExpandIconProps: getExpandIconProps,
|
|
123
|
+
onSelect: function (e, selectedItem) {
|
|
124
|
+
addTag(selectedItem);
|
|
125
|
+
resetState(e);
|
|
126
|
+
inputContainerScrollToBottom();
|
|
127
|
+
if (disableCloseOnSelect) {
|
|
128
|
+
if (autoHighlight) {
|
|
129
|
+
var currIndex = highlightedIndexRef.current;
|
|
130
|
+
var nextValidIndex = getNextFocusableOption();
|
|
131
|
+
var toIndex =
|
|
132
|
+
// * if that index is bigger than current index or nextValidIndex is last index,
|
|
133
|
+
// * cut 1 (because current item will be remove)
|
|
134
|
+
nextValidIndex > currIndex ||
|
|
135
|
+
nextValidIndex === optionItems.length - 1
|
|
136
|
+
? nextValidIndex - 1
|
|
137
|
+
: nextValidIndex;
|
|
138
|
+
setHighlightedIndex(toIndex, {
|
|
139
|
+
reRender: true,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
highlightedIndexRef.current = DEFAULT_HIGHLIGHTED_INDEX;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
}), inputValue = _j.inputValue, optionItems = _j.optionItems, optionsGroupList = _j.optionsGroupList, highlightedIndexRef = _j.highlightedIndexRef, changeHighlightedIndexReasonRef = _j.changeHighlightedIndexReasonRef, forceUpdate = _j.forceUpdate, selectItem = _j.selectItem, handleF10KeyDown = _j.handleF10KeyDown, onKeyFocusedIndexHandle = _j.onKeyFocusedIndexHandle, setHighlightedIndex = _j.setHighlightedIndex, updateInputValue = _j.updateInputValue, clearInput = _j.clearInput, getNextFocusableOption = _j.getNextFocusableOption, getItemProps = _j.getItemProps, focusInput = _j.focusInput, resetSuggestionList = _j.reset, getSuggestionListInputProps = _j.getInputProps, getSuggestionListInputAriaProps = _j.getInputAriaProps, getSuggestionListClearButtonProps = _j.getClearButtonProps, getLabelProps = _j.getLabelProps, getMenuProps = _j.getMenuProps;
|
|
148
|
+
var readOnly = !isAutocomplete && !multiple && tags.length >= 1 ? true : undefined;
|
|
179
149
|
var closeMenu = function (e, reason) {
|
|
180
150
|
keepHighlightedIndexRef.current = false;
|
|
181
151
|
isInputValueChangedRef.current = false;
|
|
@@ -217,48 +187,6 @@ export var useDownshift = function (_a) {
|
|
|
217
187
|
openMenu(e);
|
|
218
188
|
return false;
|
|
219
189
|
};
|
|
220
|
-
var getIsItemCanSelected = function (item) {
|
|
221
|
-
return ((!!item && item.freeSolo) ||
|
|
222
|
-
(isItemCanSelected(item) && !(getOptionDisabled === null || getOptionDisabled === void 0 ? void 0 : getOptionDisabled(item))));
|
|
223
|
-
};
|
|
224
|
-
/** when return `true` mean add item success */
|
|
225
|
-
var checkAndAddFreeSolo = function (_a, e) {
|
|
226
|
-
var _b = _a === void 0 ? {} : _a, selectedItem = _b.selectedItem, value = _b.value;
|
|
227
|
-
var _c;
|
|
228
|
-
var isAddItem = false;
|
|
229
|
-
var currentValue = value !== null && value !== void 0 ? value : (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.value;
|
|
230
|
-
if (!selectedItem &&
|
|
231
|
-
freeSolo &&
|
|
232
|
-
!isCompositionRef.current &&
|
|
233
|
-
currentValue &&
|
|
234
|
-
currentValue.length > 0) {
|
|
235
|
-
if (freeSoloCount < maxFreeSolo) {
|
|
236
|
-
var items = currentValue
|
|
237
|
-
.trim()
|
|
238
|
-
.split(stringArrToRegExp(keyToTags))
|
|
239
|
-
.filter(function (x) { return x.trim() !== ''; });
|
|
240
|
-
var toLength = freeSoloCount + items.length;
|
|
241
|
-
if (toLength > maxFreeSolo) {
|
|
242
|
-
items.splice(-(toLength - maxFreeSolo));
|
|
243
|
-
onMaxFreeSolo === null || onMaxFreeSolo === void 0 ? void 0 : onMaxFreeSolo(maxFreeSolo);
|
|
244
|
-
}
|
|
245
|
-
if (items.length > 0) {
|
|
246
|
-
handleSelectedItems(__spread(selectedItems, items.map(function (label) { return ({
|
|
247
|
-
id: uniqueId(DOWNSHIFT_ID_TOKEN),
|
|
248
|
-
isSuggestion: false,
|
|
249
|
-
freeSolo: true,
|
|
250
|
-
label: label,
|
|
251
|
-
}); })));
|
|
252
|
-
isAddItem = true;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
onMaxFreeSolo === null || onMaxFreeSolo === void 0 ? void 0 : onMaxFreeSolo(maxFreeSolo);
|
|
257
|
-
}
|
|
258
|
-
resetState(e);
|
|
259
|
-
}
|
|
260
|
-
return isAddItem;
|
|
261
|
-
};
|
|
262
190
|
var inputContainerScrollToBottom = function () {
|
|
263
191
|
requestAnimationFrame(function () {
|
|
264
192
|
var inputContainer = inputContainerRef === null || inputContainerRef === void 0 ? void 0 : inputContainerRef.current;
|
|
@@ -267,107 +195,24 @@ export var useDownshift = function (_a) {
|
|
|
267
195
|
}
|
|
268
196
|
});
|
|
269
197
|
};
|
|
270
|
-
var selectItemFn = function (selectedItem, e) {
|
|
271
|
-
if (getIsItemCanSelected(selectedItem)) {
|
|
272
|
-
addSelectedItem(selectedItem);
|
|
273
|
-
resetState(e);
|
|
274
|
-
inputContainerScrollToBottom();
|
|
275
|
-
if (disableCloseOnSelect) {
|
|
276
|
-
if (autoHighlight) {
|
|
277
|
-
var currIndex = highlightedIndexRef.current;
|
|
278
|
-
var nextValidIndex = getNextFocusableOption();
|
|
279
|
-
var toIndex =
|
|
280
|
-
// * if that index is bigger than current index or nextValidIndex is last index,
|
|
281
|
-
// * cut 1 (because current item will be remove)
|
|
282
|
-
nextValidIndex > currIndex ||
|
|
283
|
-
nextValidIndex === optionItems.length - 1
|
|
284
|
-
? nextValidIndex - 1
|
|
285
|
-
: nextValidIndex;
|
|
286
|
-
setHighlightedIndex(toIndex, {
|
|
287
|
-
reRender: true,
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
highlightedIndexRef.current = DEFAULT_HIGHLIGHTED_INDEX;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return true;
|
|
295
|
-
}
|
|
296
|
-
return false;
|
|
297
|
-
};
|
|
298
|
-
var removeSelectedItem = function (selectedItem) {
|
|
299
|
-
var selectedItemIndex = selectedItems.indexOf(selectedItem);
|
|
300
|
-
if (selectedItemIndex > -1) {
|
|
301
|
-
handleSelectedItems(__spread(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1)));
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
var addSelectedItem = function (selectedItem) {
|
|
305
|
-
// * change to uniqueId
|
|
306
|
-
if (selectedItem.freeSolo) {
|
|
307
|
-
noOptionItemRef.current = undefined;
|
|
308
|
-
if (freeSoloCount < maxFreeSolo) {
|
|
309
|
-
selectedItem.id = uniqueId(DOWNSHIFT_ID_TOKEN);
|
|
310
|
-
}
|
|
311
|
-
else {
|
|
312
|
-
onMaxFreeSolo === null || onMaxFreeSolo === void 0 ? void 0 : onMaxFreeSolo(maxFreeSolo);
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
if (multiple) {
|
|
317
|
-
handleSelectedItems(__spread(selectedItems, [selectedItem]));
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
handleSelectedItems([selectedItem]);
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
198
|
var resetState = function (e) {
|
|
324
|
-
if (
|
|
325
199
|
// * when autocomplete select mode not reset input value
|
|
326
|
-
!isSelectedFromAutocompleteRef.current
|
|
327
|
-
|
|
328
|
-
inputRef.current.value.length > 0) {
|
|
329
|
-
updateInputValue('');
|
|
200
|
+
if (!isSelectedFromAutocompleteRef.current) {
|
|
201
|
+
clearInput();
|
|
330
202
|
}
|
|
203
|
+
blurTags();
|
|
331
204
|
isSelectedFromAutocompleteRef.current = false;
|
|
205
|
+
noOptionItemRef.current = null;
|
|
332
206
|
isInputValueChangedRef.current = false;
|
|
333
|
-
setActiveIndex(-1);
|
|
334
207
|
if (!disableCloseOnSelect) {
|
|
335
208
|
closeMenu(e, 'select-option');
|
|
336
209
|
}
|
|
337
210
|
};
|
|
338
211
|
var reset = function (isFocus) {
|
|
339
212
|
resetState();
|
|
340
|
-
setIsTagsFocus(false);
|
|
341
|
-
onInputChangeProp === null || onInputChangeProp === void 0 ? void 0 : onInputChangeProp('');
|
|
342
213
|
onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange([]);
|
|
343
|
-
|
|
344
|
-
focusInput();
|
|
214
|
+
resetSuggestionList(isFocus);
|
|
345
215
|
};
|
|
346
|
-
var activeIndexRef = useRef(activeIndex);
|
|
347
|
-
activeIndexRef.current = activeIndex;
|
|
348
|
-
var handleTagKey = useKeyboardMoveFocus({
|
|
349
|
-
options: selectedItems,
|
|
350
|
-
focusedIndexRef: activeIndexRef,
|
|
351
|
-
infinite: 'order',
|
|
352
|
-
onFocusedIndexChange: function (event, toIndex) {
|
|
353
|
-
handleFocusTag(toIndex);
|
|
354
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
355
|
-
},
|
|
356
|
-
}).onKeyFocusedIndexHandle;
|
|
357
|
-
var _o = useKeyboardMoveFocus({
|
|
358
|
-
options: optionItems,
|
|
359
|
-
focusedIndexRef: highlightedIndexRef,
|
|
360
|
-
infinite: true,
|
|
361
|
-
onFocusedIndexChange: function (event, toIndex) {
|
|
362
|
-
setHighlightedIndex(toIndex, { reason: 'keyboard', reRender: true });
|
|
363
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
364
|
-
},
|
|
365
|
-
getOptionDisabled: disabledItemsHighlightable
|
|
366
|
-
? undefined
|
|
367
|
-
: function (child) {
|
|
368
|
-
return !getIsItemCanSelected(child);
|
|
369
|
-
},
|
|
370
|
-
}), onKeyFocusedIndexHandle = _o.onKeyFocusedIndexHandle, getNextFocusableOption = _o.getNextFocusableOption;
|
|
371
216
|
var keepHighlightedIndex = function () {
|
|
372
217
|
keepHighlightedIndexRef.current = true;
|
|
373
218
|
};
|
|
@@ -386,8 +231,8 @@ export var useDownshift = function (_a) {
|
|
|
386
231
|
if (isOpen) {
|
|
387
232
|
if (highlightedIndexRef.current === DEFAULT_HIGHLIGHTED_INDEX) {
|
|
388
233
|
var toIndex = defaultHighlightedIndex;
|
|
389
|
-
if (isAutocomplete &&
|
|
390
|
-
var itemText_1 = getOptionLabel(
|
|
234
|
+
if (isAutocomplete && tags.length === 1) {
|
|
235
|
+
var itemText_1 = getOptionLabel(tags[0]);
|
|
391
236
|
var fIndex = optionItems.findIndex(function (x) { return getOptionLabel(x) === itemText_1; });
|
|
392
237
|
if (fIndex > -1) {
|
|
393
238
|
toIndex = fIndex;
|
|
@@ -409,8 +254,8 @@ export var useDownshift = function (_a) {
|
|
|
409
254
|
}
|
|
410
255
|
}
|
|
411
256
|
var handleAutocompleteText = function () {
|
|
412
|
-
if (isAutocomplete &&
|
|
413
|
-
var result = getOptionLabel(
|
|
257
|
+
if (isAutocomplete && tags.length > 0) {
|
|
258
|
+
var result = getOptionLabel(tags[0]);
|
|
414
259
|
onInputChangeProp === null || onInputChangeProp === void 0 ? void 0 : onInputChangeProp(result);
|
|
415
260
|
}
|
|
416
261
|
};
|
|
@@ -422,103 +267,9 @@ export var useDownshift = function (_a) {
|
|
|
422
267
|
handleAutocompleteText();
|
|
423
268
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
424
269
|
}, []);
|
|
425
|
-
/**
|
|
426
|
-
* All Get props methods
|
|
427
|
-
*/
|
|
428
|
-
var getTagListBoxProps = function (props) {
|
|
429
|
-
return __assign({ 'aria-label': isString(labelProp) ? labelProp : undefined, 'aria-required': required || false, 'aria-disabled': disabled || false }, props);
|
|
430
|
-
};
|
|
431
|
-
var getItemProps = function (_a) {
|
|
432
|
-
var item = _a.item, index = _a.index, itemRest = __rest(_a, ["item", "index"]);
|
|
433
|
-
return combineProps({
|
|
434
|
-
id: downshiftId + "-option-" + index,
|
|
435
|
-
role: 'option',
|
|
436
|
-
onClick: function (e) {
|
|
437
|
-
selectItemFn(item, e);
|
|
438
|
-
},
|
|
439
|
-
onMouseDown: function (e) {
|
|
440
|
-
e.preventDefault();
|
|
441
|
-
e.stopPropagation();
|
|
442
|
-
},
|
|
443
|
-
onMouseOver: function () {
|
|
444
|
-
if (highlightedIndexRef.current !== index) {
|
|
445
|
-
setHighlightedIndex(index, { reason: 'mouse', reRender: true });
|
|
446
|
-
}
|
|
447
|
-
},
|
|
448
|
-
}, itemRest);
|
|
449
|
-
};
|
|
450
|
-
var getTagProps = function (_a) {
|
|
451
|
-
var index = _a.index, selectedItem = _a.selectedItem, restTagProps = __rest(_a, ["index", "selectedItem"]);
|
|
452
|
-
var tabIndex =
|
|
453
|
-
// * when tag is not focus
|
|
454
|
-
!isTagsFocus &&
|
|
455
|
-
// * and is first item
|
|
456
|
-
index === 0
|
|
457
|
-
? 0
|
|
458
|
-
: -1;
|
|
459
|
-
return combineProps({
|
|
460
|
-
tabIndex: tabIndex,
|
|
461
|
-
// TODO: wait for input can complete that.
|
|
462
|
-
// role: 'option',
|
|
463
|
-
role: 'button',
|
|
464
|
-
key: downshiftId + "-selected-item-" + index,
|
|
465
|
-
'data-tag-index': index,
|
|
466
|
-
'data-item-last': index === selectedItems.length - 1,
|
|
467
|
-
onClick: function (e) {
|
|
468
|
-
e.stopPropagation();
|
|
469
|
-
},
|
|
470
|
-
onBlur: function () { return setIsTagsFocus(false); },
|
|
471
|
-
onFocus: function () {
|
|
472
|
-
handleFocusTag(index);
|
|
473
|
-
setIsTagsFocus(true);
|
|
474
|
-
},
|
|
475
|
-
onKeyDown: function (e) {
|
|
476
|
-
switch (e.key) {
|
|
477
|
-
case 'Backspace':
|
|
478
|
-
{
|
|
479
|
-
var lengthBeforeDelete = selectedItems.length;
|
|
480
|
-
handleFocusTag(
|
|
481
|
-
// * when length is 1 mean that will be remove all
|
|
482
|
-
lengthBeforeDelete === 1
|
|
483
|
-
? -1
|
|
484
|
-
: activeIndex === 0
|
|
485
|
-
? 0
|
|
486
|
-
: activeIndex - 1);
|
|
487
|
-
removeSelectedItem(selectedItem);
|
|
488
|
-
}
|
|
489
|
-
break;
|
|
490
|
-
case 'Delete':
|
|
491
|
-
{
|
|
492
|
-
var lengthBeforeDelete = selectedItems.length;
|
|
493
|
-
handleFocusTag(
|
|
494
|
-
// * when length is 1 mean that will be remove all
|
|
495
|
-
lengthBeforeDelete === 1
|
|
496
|
-
? -1
|
|
497
|
-
: activeIndex === selectedItems.length - 1
|
|
498
|
-
? activeIndex - 1
|
|
499
|
-
: activeIndex);
|
|
500
|
-
removeSelectedItem(selectedItem);
|
|
501
|
-
}
|
|
502
|
-
break;
|
|
503
|
-
default:
|
|
504
|
-
handleTagKey(e);
|
|
505
|
-
break;
|
|
506
|
-
}
|
|
507
|
-
},
|
|
508
|
-
onDelete: function (e) {
|
|
509
|
-
// * left button clicked
|
|
510
|
-
if (e.button === 0) {
|
|
511
|
-
removeSelectedItem(selectedItem);
|
|
512
|
-
setIsTagsFocus(false);
|
|
513
|
-
}
|
|
514
|
-
},
|
|
515
|
-
}, restTagProps);
|
|
516
|
-
};
|
|
517
270
|
var getInputProps = function (props) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
autoComplete: 'off',
|
|
521
|
-
onPaste: function (e) {
|
|
271
|
+
var suggestionListItemProps = getSuggestionListInputProps(props);
|
|
272
|
+
return combineProps(__assign(__assign({}, suggestionListItemProps), { onPaste: function (e) {
|
|
522
273
|
var _a;
|
|
523
274
|
if (freeSolo) {
|
|
524
275
|
var clipboardData = e.clipboardData;
|
|
@@ -533,20 +284,18 @@ export var useDownshift = function (_a) {
|
|
|
533
284
|
pasteText +
|
|
534
285
|
currText.slice(position.end);
|
|
535
286
|
}
|
|
536
|
-
},
|
|
537
|
-
onChange: function (e) {
|
|
287
|
+
}, onChange: function (e) {
|
|
538
288
|
var changeValue = fromPasteString.current || e.target.value;
|
|
539
289
|
handleInputChange(changeValue, undefined, e);
|
|
540
290
|
// * when input value clear all, clear selected item
|
|
541
291
|
if (isAutocomplete && changeValue.length === 0) {
|
|
542
|
-
|
|
292
|
+
clearTags();
|
|
543
293
|
}
|
|
544
294
|
fromPasteString.current = '';
|
|
545
295
|
isInputValueChangedRef.current = true;
|
|
546
|
-
},
|
|
547
|
-
onFocus: function (e) {
|
|
296
|
+
}, onFocus: function (e) {
|
|
548
297
|
var _a;
|
|
549
|
-
|
|
298
|
+
setInputFocused(true);
|
|
550
299
|
if (openOnFocus)
|
|
551
300
|
openMenu(e);
|
|
552
301
|
// * when autocomplete mode, always select all text when focus
|
|
@@ -555,25 +304,20 @@ export var useDownshift = function (_a) {
|
|
|
555
304
|
}
|
|
556
305
|
// * reset stopAutoSelect in focus input
|
|
557
306
|
stopAutoSelectRef.current = false;
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
},
|
|
562
|
-
onBlur: function (e) {
|
|
563
|
-
setIsFocused(false);
|
|
307
|
+
blurTags();
|
|
308
|
+
}, onBlur: function (e) {
|
|
309
|
+
setInputFocused(false);
|
|
564
310
|
if (autoSelect && !stopAutoSelectRef.current) {
|
|
565
311
|
if (!freeSolo)
|
|
566
|
-
|
|
312
|
+
selectItem(e, optionItems[highlightedIndexRef.current]);
|
|
567
313
|
checkAndAddFreeSolo({}, e);
|
|
568
314
|
}
|
|
569
315
|
// * when blur should restore text when have selected item
|
|
570
316
|
handleAutocompleteText();
|
|
571
317
|
closeMenu(e, 'blur');
|
|
572
|
-
},
|
|
573
|
-
onCompositionStart: function () {
|
|
318
|
+
}, onCompositionStart: function () {
|
|
574
319
|
isCompositionRef.current = true;
|
|
575
|
-
},
|
|
576
|
-
onCompositionEnd: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
320
|
+
}, onCompositionEnd: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
577
321
|
return __generator(this, function (_a) {
|
|
578
322
|
switch (_a.label) {
|
|
579
323
|
case 0:
|
|
@@ -586,20 +330,17 @@ export var useDownshift = function (_a) {
|
|
|
586
330
|
return [2 /*return*/];
|
|
587
331
|
}
|
|
588
332
|
});
|
|
589
|
-
}); },
|
|
590
|
-
onKeyDown: function (e) {
|
|
333
|
+
}); }, onKeyDown: function (e) {
|
|
591
334
|
keepHighlightedIndexRef.current = false;
|
|
592
335
|
onKeyDownProp === null || onKeyDownProp === void 0 ? void 0 : onKeyDownProp(e, highlightedIndexRef.current);
|
|
593
336
|
var _a = getSelectionPosition(inputRef), isSelectRange = _a.isSelectRange, position = _a.position;
|
|
594
|
-
var currTagsLength =
|
|
337
|
+
var currTagsLength = tags.length;
|
|
595
338
|
if (!isSelectRange &&
|
|
596
339
|
position.start === 0 &&
|
|
597
340
|
currTagsLength > 0 &&
|
|
598
341
|
e.key === 'Backspace') {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
handleFocusTag(currTagsLength - 1);
|
|
602
|
-
}
|
|
342
|
+
stopAutoSelectRef.current = true;
|
|
343
|
+
focusLastTag();
|
|
603
344
|
}
|
|
604
345
|
else {
|
|
605
346
|
var highlightedIndex = highlightedIndexRef.current;
|
|
@@ -631,7 +372,7 @@ export var useDownshift = function (_a) {
|
|
|
631
372
|
if (!e.shiftKey && !isCompositionRef.current) {
|
|
632
373
|
var currentHighlightItem = optionItems[highlightedIndex];
|
|
633
374
|
if (isOpen && currentHighlightItem) {
|
|
634
|
-
if (
|
|
375
|
+
if (selectItem(e, currentHighlightItem)) {
|
|
635
376
|
e.preventDefault();
|
|
636
377
|
e.stopPropagation();
|
|
637
378
|
}
|
|
@@ -658,20 +399,14 @@ export var useDownshift = function (_a) {
|
|
|
658
399
|
else if (highlightedIndex !== DEFAULT_HIGHLIGHTED_INDEX &&
|
|
659
400
|
isOpen &&
|
|
660
401
|
!isCompositionRef.current) {
|
|
661
|
-
|
|
402
|
+
selectItem(e, optionItems[highlightedIndex]);
|
|
662
403
|
e.stopPropagation();
|
|
663
404
|
}
|
|
664
405
|
// always preventDefault for not inset all enter into textarea
|
|
665
406
|
e.preventDefault();
|
|
666
407
|
break;
|
|
667
408
|
case 'F10':
|
|
668
|
-
|
|
669
|
-
var currOption = optionItems[highlightedIndex];
|
|
670
|
-
var currentGroup = currOption.group;
|
|
671
|
-
if (currentGroup && currentGroup.options.length > 1) {
|
|
672
|
-
handleGroupExpandedChange(currentGroup.group);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
409
|
+
handleF10KeyDown(e);
|
|
675
410
|
break;
|
|
676
411
|
case 'ArrowUp':
|
|
677
412
|
case 'ArrowDown':
|
|
@@ -680,7 +415,7 @@ export var useDownshift = function (_a) {
|
|
|
680
415
|
return;
|
|
681
416
|
}
|
|
682
417
|
// * check state for is that should move key in option items
|
|
683
|
-
if (isAutocomplete &&
|
|
418
|
+
if (isAutocomplete && tags.length > 0 && !isOpen) {
|
|
684
419
|
openMenu(e);
|
|
685
420
|
e.preventDefault();
|
|
686
421
|
break;
|
|
@@ -695,30 +430,11 @@ export var useDownshift = function (_a) {
|
|
|
695
430
|
break;
|
|
696
431
|
}
|
|
697
432
|
}
|
|
698
|
-
},
|
|
699
|
-
}, props);
|
|
433
|
+
} }), props);
|
|
700
434
|
};
|
|
701
435
|
var getInputAriaProps = function (props) {
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
// * provide for when container click focus on input
|
|
705
|
-
onContainerClick: focusInput,
|
|
706
|
-
unselectable: readOnly ? 'on' : undefined,
|
|
707
|
-
role: 'combobox',
|
|
708
|
-
'aria-autocomplete': 'list',
|
|
709
|
-
'aria-expanded': !!isOpen,
|
|
710
|
-
'aria-haspopup': true,
|
|
711
|
-
'aria-owns': isOpen ? downshiftId + "-menu" : undefined,
|
|
712
|
-
'aria-activedescendant': isOpen && highlightedIndexRef.current > -1
|
|
713
|
-
? downshiftId + "-option-" + highlightedIndexRef.current
|
|
714
|
-
: undefined,
|
|
715
|
-
}, props);
|
|
716
|
-
};
|
|
717
|
-
var getLabelProps = function (props) {
|
|
718
|
-
return combineProps({
|
|
719
|
-
htmlFor: downshiftId + "-input",
|
|
720
|
-
id: downshiftId + "-label",
|
|
721
|
-
}, props);
|
|
436
|
+
var suggestionListInputAriaProps = getSuggestionListInputAriaProps(props);
|
|
437
|
+
return combineProps(__assign(__assign({}, suggestionListInputAriaProps), { readOnly: readOnly, unselectable: readOnly ? 'on' : undefined, 'aria-owns': isOpen ? downshiftId + "-menu" : undefined, 'aria-expanded': !!isOpen }), props);
|
|
722
438
|
};
|
|
723
439
|
var getPopperProps = function (restPopperProps) {
|
|
724
440
|
var _a;
|
|
@@ -732,13 +448,6 @@ export var useDownshift = function (_a) {
|
|
|
732
448
|
},
|
|
733
449
|
}, restPopperProps);
|
|
734
450
|
};
|
|
735
|
-
var getMenuProps = function (restMenuProps) {
|
|
736
|
-
return combineProps({
|
|
737
|
-
'aria-labelledby': downshiftId + "-label",
|
|
738
|
-
id: downshiftId + "-menu",
|
|
739
|
-
role: 'listbox',
|
|
740
|
-
}, restMenuProps);
|
|
741
|
-
};
|
|
742
451
|
var getToggleButtonProps = function (props) {
|
|
743
452
|
return combineProps({
|
|
744
453
|
disabled: (!isOpen && optionItems.length === 0) || disabled || readOnly,
|
|
@@ -760,13 +469,11 @@ export var useDownshift = function (_a) {
|
|
|
760
469
|
}, props);
|
|
761
470
|
};
|
|
762
471
|
var getClearButtonProps = function (props) {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
onClick: function (e) {
|
|
472
|
+
var suggestionListClearButtonProps = getSuggestionListClearButtonProps(props);
|
|
473
|
+
return combineProps(__assign(__assign({}, suggestionListClearButtonProps), { onClick: function (e) {
|
|
766
474
|
onClear === null || onClear === void 0 ? void 0 : onClear(e);
|
|
767
475
|
reset(true);
|
|
768
|
-
},
|
|
769
|
-
}, props);
|
|
476
|
+
} }), props);
|
|
770
477
|
};
|
|
771
478
|
var getNoOptionsProps = function (additionProps) {
|
|
772
479
|
return combineProps({
|
|
@@ -776,17 +483,14 @@ export var useDownshift = function (_a) {
|
|
|
776
483
|
role: 'presentation',
|
|
777
484
|
}, additionProps);
|
|
778
485
|
};
|
|
779
|
-
|
|
486
|
+
return {
|
|
780
487
|
focusInput: focusInput,
|
|
781
|
-
setIsTagsFocus: setIsTagsFocus,
|
|
782
488
|
readOnly: readOnly,
|
|
783
489
|
getTagProps: getTagProps,
|
|
784
490
|
getClearButtonProps: getClearButtonProps,
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
setActiveIndex: handleFocusTag,
|
|
491
|
+
activeIndex: focusedTagIndex,
|
|
492
|
+
setActiveIndex: focusTag,
|
|
788
493
|
isOpen: isOpen,
|
|
789
|
-
isTagsFocus: isTagsFocus,
|
|
790
494
|
getToggleButtonProps: getToggleButtonProps,
|
|
791
495
|
getPopperProps: getPopperProps,
|
|
792
496
|
getLabelProps: getLabelProps,
|
|
@@ -798,23 +502,22 @@ export var useDownshift = function (_a) {
|
|
|
798
502
|
getNoOptionsProps: getNoOptionsProps,
|
|
799
503
|
noOptionItem: noOptionItemRef.current,
|
|
800
504
|
highlightedIndex: highlightedIndexRef.current,
|
|
801
|
-
|
|
505
|
+
tags: tags,
|
|
802
506
|
optionItems: optionItems,
|
|
803
507
|
inputValue: inputValue,
|
|
804
508
|
onInputChange: handleInputChange,
|
|
805
509
|
keepHighlightedIndex: keepHighlightedIndex,
|
|
806
510
|
isKeepHighlightedIndex: keepHighlightedIndexRef.current,
|
|
807
511
|
setHighlightedIndex: setHighlightedIndex,
|
|
808
|
-
changeHighlightedIndexReason:
|
|
512
|
+
changeHighlightedIndexReason: changeHighlightedIndexReasonRef.current,
|
|
809
513
|
closeMenu: closeMenu,
|
|
810
514
|
openMenu: openMenu,
|
|
811
515
|
reset: reset,
|
|
812
516
|
forceUpdate: forceUpdate,
|
|
813
517
|
optionsGroupList: optionsGroupList,
|
|
814
|
-
|
|
518
|
+
/** that state of current downshift focused, both tag or input focused */
|
|
519
|
+
focused: focused !== null && focused !== void 0 ? focused : (tagFocused || inputFocused ? true : undefined),
|
|
815
520
|
id: downshiftId,
|
|
816
521
|
inputChanged: isInputValueChangedRef.current,
|
|
817
522
|
};
|
|
818
|
-
changeHighlightedIndexReason.current = undefined;
|
|
819
|
-
return resultObj;
|
|
820
523
|
};
|