@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
|
@@ -2,71 +2,63 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var react_1 = require("react");
|
|
5
|
-
var isString_1 = tslib_1.__importDefault(require("lodash/isString"));
|
|
6
|
-
var uniqueId_1 = tslib_1.__importDefault(require("lodash/uniqueId"));
|
|
7
5
|
var utils_1 = require("@material-ui/core/utils");
|
|
8
6
|
var foundation_1 = require("../../../foundation");
|
|
7
|
+
var useSuggestionList_1 = require("../SuggestionList/utils/useSuggestionList");
|
|
9
8
|
var DownshiftUtils_1 = require("./DownshiftUtils");
|
|
10
|
-
var
|
|
11
|
-
var DOWNSHIFT_ID_TOKEN = 'rc-chip-';
|
|
9
|
+
var useDownshiftTag_1 = require("./useDownshiftTag");
|
|
12
10
|
var DOWNSHIFT_ID_NO_RESULT_TOKEN = 'rc-chip-empty';
|
|
13
11
|
var DEFAULT_HIGHLIGHTED_INDEX = -1;
|
|
14
|
-
function stringArrToRegExp(keyToTags) {
|
|
15
|
-
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
16
|
-
return new RegExp((keyToTags === null || keyToTags === void 0 ? void 0 : keyToTags.join('|')) || '', 'g');
|
|
17
|
-
}
|
|
18
|
-
var componentName = 'RcDownshift';
|
|
19
12
|
exports.useDownshift = function (_a) {
|
|
20
|
-
var multipleProp = _a.multiple, variant = _a.variant, labelProp = _a.label, inputValueProp = _a.inputValue, _b = _a.getOptionLabel, getOptionLabel = _b === void 0 ? DownshiftUtils_1.DEFAULT_GET_OPTION_LABEL : _b, _c = _a.keyToTags, keyToTags = _c === void 0 ? DownshiftUtils_1.DEFAULT_KEY_TO_CHIPS : _c,
|
|
13
|
+
var multipleProp = _a.multiple, variant = _a.variant, labelProp = _a.label, inputValueProp = _a.inputValue, _b = _a.getOptionLabel, getOptionLabel = _b === void 0 ? DownshiftUtils_1.DEFAULT_GET_OPTION_LABEL : _b, _c = _a.keyToTags, keyToTags = _c === void 0 ? DownshiftUtils_1.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;
|
|
21
14
|
var isAutocomplete = variant === 'autocomplete';
|
|
22
|
-
|
|
23
|
-
var multiple = isAutocomplete ? false : multipleProp;
|
|
24
|
-
var isSelectedFromAutocompleteRef = react_1.useRef(false);
|
|
25
|
-
var isInputValueChangedRef = react_1.useRef(false);
|
|
15
|
+
var downshiftId = foundation_1.useId('downshift', true);
|
|
26
16
|
var _e = tslib_1.__read(utils_1.useControlled({
|
|
27
|
-
controlled:
|
|
17
|
+
controlled: focused,
|
|
28
18
|
default: false,
|
|
29
|
-
name:
|
|
30
|
-
}), 2),
|
|
19
|
+
name: DownshiftUtils_1.downshiftComponentName,
|
|
20
|
+
}), 2), inputFocused = _e[0], setInputFocused = _e[1];
|
|
31
21
|
var _f = tslib_1.__read(utils_1.useControlled({
|
|
32
22
|
controlled: openProp,
|
|
33
23
|
default: initialIsOpen || false,
|
|
34
|
-
name:
|
|
24
|
+
name: DownshiftUtils_1.downshiftComponentName,
|
|
35
25
|
}), 2), isOpen = _f[0], setIsOpen = _f[1];
|
|
36
|
-
var
|
|
37
|
-
var _h = tslib_1.__read(react_1.useState(0), 2), activeIndex = _h[0], setActiveIndex = _h[1];
|
|
38
|
-
var _j = tslib_1.__read(utils_1.useControlled({
|
|
39
|
-
controlled: inputValueProp,
|
|
40
|
-
default: '',
|
|
41
|
-
name: componentName,
|
|
42
|
-
}), 2), inputValue = _j[0], setInputValue = _j[1];
|
|
43
|
-
var updateInputValue = function (newValue) {
|
|
44
|
-
onInputChangeProp === null || onInputChangeProp === void 0 ? void 0 : onInputChangeProp(newValue);
|
|
45
|
-
setInputValue(newValue);
|
|
46
|
-
};
|
|
47
|
-
var _k = tslib_1.__read(utils_1.useControlled({
|
|
48
|
-
controlled: selectedItemsProp,
|
|
49
|
-
default: [],
|
|
50
|
-
name: componentName,
|
|
51
|
-
}), 2), selectedItems = _k[0], setSelectedItems = _k[1];
|
|
52
|
-
var focusInput = function () { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
53
|
-
var downshiftId = foundation_1.useResultRef(function () { return uniqueId_1.default("downshift-"); }).current;
|
|
54
|
-
// * use -2 for us know that is init state, for recalculate defaultHighlightedIndex
|
|
55
|
-
var highlightedIndexRef = react_1.useRef(DEFAULT_HIGHLIGHTED_INDEX);
|
|
26
|
+
var isInputValueChangedRef = react_1.useRef(false);
|
|
56
27
|
var isCompositionRef = react_1.useRef(false);
|
|
57
|
-
var noOptionItemRef = react_1.useRef();
|
|
28
|
+
var noOptionItemRef = react_1.useRef(null);
|
|
58
29
|
var stopAutoSelectRef = react_1.useRef(false);
|
|
59
30
|
var fromPasteString = react_1.useRef('');
|
|
60
31
|
var keepHighlightedIndexRef = react_1.useRef(false);
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
32
|
+
var _g = foundation_1.useSleep(), sleep = _g.sleep, getSleeping = _g.getSleeping;
|
|
33
|
+
// * when that is autocomplete, that will never be multiple
|
|
34
|
+
var multiple = isAutocomplete ? false : multipleProp;
|
|
35
|
+
var _h = useDownshiftTag_1.useDownshiftTag({
|
|
36
|
+
id: downshiftId,
|
|
37
|
+
value: selectedItemsProp,
|
|
38
|
+
onChange: onSelectChange,
|
|
39
|
+
getOptionLabel: getOptionLabel,
|
|
40
|
+
onInputChange: onInputChangeProp,
|
|
41
|
+
variant: variant,
|
|
42
|
+
wrapperRef: wrapperRef,
|
|
43
|
+
inputRef: inputRef,
|
|
44
|
+
freeSolo: freeSolo,
|
|
45
|
+
maxFreeSolo: maxFreeSolo,
|
|
46
|
+
keyToTags: keyToTags,
|
|
47
|
+
onMaxFreeSolo: onMaxFreeSolo,
|
|
48
|
+
multiple: multiple,
|
|
49
|
+
label: labelProp,
|
|
50
|
+
required: required,
|
|
51
|
+
disabled: disabled,
|
|
52
|
+
// * when is composition, stop freeSolo create new item
|
|
53
|
+
getStopCreateFreeSolo: function () { return isCompositionRef.current; },
|
|
54
|
+
onReset: function () {
|
|
55
|
+
resetState();
|
|
56
|
+
},
|
|
57
|
+
}), 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;
|
|
58
|
+
var processFilteredResult = react_1.useCallback(function (results, inputValue) {
|
|
59
|
+
if (inputValue === void 0) { inputValue = ''; }
|
|
68
60
|
var getInputValueAsItem = function () {
|
|
69
|
-
var label = inputValue.trim()
|
|
61
|
+
var label = inputValue.trim();
|
|
70
62
|
if (label.length > 0) {
|
|
71
63
|
var item = {
|
|
72
64
|
id: DOWNSHIFT_ID_NO_RESULT_TOKEN,
|
|
@@ -76,22 +68,10 @@ exports.useDownshift = function (_a) {
|
|
|
76
68
|
};
|
|
77
69
|
return item;
|
|
78
70
|
}
|
|
79
|
-
return
|
|
80
|
-
};
|
|
81
|
-
var getFilteredItems = function (items) {
|
|
82
|
-
if (filterOptions) {
|
|
83
|
-
return filterOptions(items, {
|
|
84
|
-
inputValue: inputValue,
|
|
85
|
-
inputChanged: isInputValueChangedRef.current,
|
|
86
|
-
getOptionLabel: getOptionLabel,
|
|
87
|
-
selectedItems: selectedItems,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
return items;
|
|
71
|
+
return null;
|
|
91
72
|
};
|
|
92
73
|
// * only when isOpen calculate the filtered result
|
|
93
|
-
|
|
94
|
-
noOptionItemRef.current = undefined;
|
|
74
|
+
noOptionItemRef.current = null;
|
|
95
75
|
if (addNoOptionItem) {
|
|
96
76
|
var item = getInputValueAsItem();
|
|
97
77
|
noOptionItemRef.current = item;
|
|
@@ -116,68 +96,58 @@ exports.useDownshift = function (_a) {
|
|
|
116
96
|
}
|
|
117
97
|
}
|
|
118
98
|
return results;
|
|
119
|
-
}, [
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
groupBy: groupBy,
|
|
99
|
+
}, [addNoOptionItem, freeSolo, renderNoOptions]);
|
|
100
|
+
var filterOptions = react_1.useCallback(function (items, state) {
|
|
101
|
+
if (filterOptionsProp) {
|
|
102
|
+
return filterOptionsProp(items, tslib_1.__assign(tslib_1.__assign({}, state), { inputChanged: isInputValueChangedRef.current, selectedItems: tags }));
|
|
103
|
+
}
|
|
104
|
+
return items;
|
|
105
|
+
}, [filterOptionsProp, tags]);
|
|
106
|
+
var _j = useSuggestionList_1.useSuggestionList({
|
|
107
|
+
id: downshiftId,
|
|
108
|
+
inputRef: inputRef,
|
|
109
|
+
inputValue: inputValueProp,
|
|
131
110
|
options: options,
|
|
132
|
-
|
|
133
|
-
|
|
111
|
+
disabledItemsHighlightable: disabledItemsHighlightable,
|
|
112
|
+
groupVariant: groupVariant,
|
|
134
113
|
groupExpanded: groupExpanded,
|
|
135
114
|
groupDefaultExpanded: groupDefaultExpanded,
|
|
115
|
+
getOptionLabel: getOptionLabel,
|
|
116
|
+
filterOptions: filterOptions,
|
|
117
|
+
processFilteredResult: processFilteredResult,
|
|
118
|
+
onInputChange: onInputChangeProp,
|
|
119
|
+
onKeyDown: onKeyDownProp,
|
|
120
|
+
onClear: onClear,
|
|
121
|
+
getOptionDisabled: getOptionDisabled,
|
|
122
|
+
groupBy: groupBy,
|
|
136
123
|
onGroupExpanded: onGroupExpanded,
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
var textFieldElm = wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current;
|
|
165
|
-
var inputElm = inputRef.current;
|
|
166
|
-
if (tagToFocus === -1) {
|
|
167
|
-
inputElm === null || inputElm === void 0 ? void 0 : inputElm.focus();
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
(_a = textFieldElm === null || textFieldElm === void 0 ? void 0 : textFieldElm.querySelector("[data-tag-index=\"" + tagToFocus + "\"]")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
var handleFocusTag = foundation_1.useEventCallback(function (tagToFocus, focus) {
|
|
174
|
-
if (focus === void 0) { focus = true; }
|
|
175
|
-
if (activeIndex === tagToFocus)
|
|
176
|
-
return;
|
|
177
|
-
setActiveIndex(tagToFocus);
|
|
178
|
-
if (focus)
|
|
179
|
-
focusTag(tagToFocus);
|
|
180
|
-
});
|
|
124
|
+
getExpandIconProps: getExpandIconProps,
|
|
125
|
+
onSelect: function (e, selectedItem) {
|
|
126
|
+
addTag(selectedItem);
|
|
127
|
+
resetState(e);
|
|
128
|
+
inputContainerScrollToBottom();
|
|
129
|
+
if (disableCloseOnSelect) {
|
|
130
|
+
if (autoHighlight) {
|
|
131
|
+
var currIndex = highlightedIndexRef.current;
|
|
132
|
+
var nextValidIndex = getNextFocusableOption();
|
|
133
|
+
var toIndex =
|
|
134
|
+
// * if that index is bigger than current index or nextValidIndex is last index,
|
|
135
|
+
// * cut 1 (because current item will be remove)
|
|
136
|
+
nextValidIndex > currIndex ||
|
|
137
|
+
nextValidIndex === optionItems.length - 1
|
|
138
|
+
? nextValidIndex - 1
|
|
139
|
+
: nextValidIndex;
|
|
140
|
+
setHighlightedIndex(toIndex, {
|
|
141
|
+
reRender: true,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
highlightedIndexRef.current = DEFAULT_HIGHLIGHTED_INDEX;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
}), 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;
|
|
150
|
+
var readOnly = !isAutocomplete && !multiple && tags.length >= 1 ? true : undefined;
|
|
181
151
|
var closeMenu = function (e, reason) {
|
|
182
152
|
keepHighlightedIndexRef.current = false;
|
|
183
153
|
isInputValueChangedRef.current = false;
|
|
@@ -203,7 +173,7 @@ exports.useDownshift = function (_a) {
|
|
|
203
173
|
setHighlightedIndex(DEFAULT_HIGHLIGHTED_INDEX, { reason: 'auto' });
|
|
204
174
|
// !!! Get regexp every time for prevent bug with browser
|
|
205
175
|
// https://stackoverflow.com/questions/3827456/what-is-wrong-with-my-date-regex/3827500#3827500
|
|
206
|
-
if (stringArrToRegExp(keyToTags).test((newValue || '').trim())) {
|
|
176
|
+
if (DownshiftUtils_1.stringArrToRegExp(keyToTags).test((newValue || '').trim())) {
|
|
207
177
|
var resultHaveAdd = checkAndAddFreeSolo({ value: newValue }, e);
|
|
208
178
|
if (!disableCloseOnSelect) {
|
|
209
179
|
closeMenu(e, 'toggleInput');
|
|
@@ -219,48 +189,6 @@ exports.useDownshift = function (_a) {
|
|
|
219
189
|
openMenu(e);
|
|
220
190
|
return false;
|
|
221
191
|
};
|
|
222
|
-
var getIsItemCanSelected = function (item) {
|
|
223
|
-
return ((!!item && item.freeSolo) ||
|
|
224
|
-
(DownshiftUtils_1.isItemCanSelected(item) && !(getOptionDisabled === null || getOptionDisabled === void 0 ? void 0 : getOptionDisabled(item))));
|
|
225
|
-
};
|
|
226
|
-
/** when return `true` mean add item success */
|
|
227
|
-
var checkAndAddFreeSolo = function (_a, e) {
|
|
228
|
-
var _b = _a === void 0 ? {} : _a, selectedItem = _b.selectedItem, value = _b.value;
|
|
229
|
-
var _c;
|
|
230
|
-
var isAddItem = false;
|
|
231
|
-
var currentValue = value !== null && value !== void 0 ? value : (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.value;
|
|
232
|
-
if (!selectedItem &&
|
|
233
|
-
freeSolo &&
|
|
234
|
-
!isCompositionRef.current &&
|
|
235
|
-
currentValue &&
|
|
236
|
-
currentValue.length > 0) {
|
|
237
|
-
if (freeSoloCount < maxFreeSolo) {
|
|
238
|
-
var items = currentValue
|
|
239
|
-
.trim()
|
|
240
|
-
.split(stringArrToRegExp(keyToTags))
|
|
241
|
-
.filter(function (x) { return x.trim() !== ''; });
|
|
242
|
-
var toLength = freeSoloCount + items.length;
|
|
243
|
-
if (toLength > maxFreeSolo) {
|
|
244
|
-
items.splice(-(toLength - maxFreeSolo));
|
|
245
|
-
onMaxFreeSolo === null || onMaxFreeSolo === void 0 ? void 0 : onMaxFreeSolo(maxFreeSolo);
|
|
246
|
-
}
|
|
247
|
-
if (items.length > 0) {
|
|
248
|
-
handleSelectedItems(tslib_1.__spread(selectedItems, items.map(function (label) { return ({
|
|
249
|
-
id: uniqueId_1.default(DOWNSHIFT_ID_TOKEN),
|
|
250
|
-
isSuggestion: false,
|
|
251
|
-
freeSolo: true,
|
|
252
|
-
label: label,
|
|
253
|
-
}); })));
|
|
254
|
-
isAddItem = true;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
onMaxFreeSolo === null || onMaxFreeSolo === void 0 ? void 0 : onMaxFreeSolo(maxFreeSolo);
|
|
259
|
-
}
|
|
260
|
-
resetState(e);
|
|
261
|
-
}
|
|
262
|
-
return isAddItem;
|
|
263
|
-
};
|
|
264
192
|
var inputContainerScrollToBottom = function () {
|
|
265
193
|
requestAnimationFrame(function () {
|
|
266
194
|
var inputContainer = inputContainerRef === null || inputContainerRef === void 0 ? void 0 : inputContainerRef.current;
|
|
@@ -269,107 +197,24 @@ exports.useDownshift = function (_a) {
|
|
|
269
197
|
}
|
|
270
198
|
});
|
|
271
199
|
};
|
|
272
|
-
var selectItemFn = function (selectedItem, e) {
|
|
273
|
-
if (getIsItemCanSelected(selectedItem)) {
|
|
274
|
-
addSelectedItem(selectedItem);
|
|
275
|
-
resetState(e);
|
|
276
|
-
inputContainerScrollToBottom();
|
|
277
|
-
if (disableCloseOnSelect) {
|
|
278
|
-
if (autoHighlight) {
|
|
279
|
-
var currIndex = highlightedIndexRef.current;
|
|
280
|
-
var nextValidIndex = getNextFocusableOption();
|
|
281
|
-
var toIndex =
|
|
282
|
-
// * if that index is bigger than current index or nextValidIndex is last index,
|
|
283
|
-
// * cut 1 (because current item will be remove)
|
|
284
|
-
nextValidIndex > currIndex ||
|
|
285
|
-
nextValidIndex === optionItems.length - 1
|
|
286
|
-
? nextValidIndex - 1
|
|
287
|
-
: nextValidIndex;
|
|
288
|
-
setHighlightedIndex(toIndex, {
|
|
289
|
-
reRender: true,
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
highlightedIndexRef.current = DEFAULT_HIGHLIGHTED_INDEX;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return true;
|
|
297
|
-
}
|
|
298
|
-
return false;
|
|
299
|
-
};
|
|
300
|
-
var removeSelectedItem = function (selectedItem) {
|
|
301
|
-
var selectedItemIndex = selectedItems.indexOf(selectedItem);
|
|
302
|
-
if (selectedItemIndex > -1) {
|
|
303
|
-
handleSelectedItems(tslib_1.__spread(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1)));
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
var addSelectedItem = function (selectedItem) {
|
|
307
|
-
// * change to uniqueId
|
|
308
|
-
if (selectedItem.freeSolo) {
|
|
309
|
-
noOptionItemRef.current = undefined;
|
|
310
|
-
if (freeSoloCount < maxFreeSolo) {
|
|
311
|
-
selectedItem.id = uniqueId_1.default(DOWNSHIFT_ID_TOKEN);
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
onMaxFreeSolo === null || onMaxFreeSolo === void 0 ? void 0 : onMaxFreeSolo(maxFreeSolo);
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
if (multiple) {
|
|
319
|
-
handleSelectedItems(tslib_1.__spread(selectedItems, [selectedItem]));
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
handleSelectedItems([selectedItem]);
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
200
|
var resetState = function (e) {
|
|
326
|
-
if (
|
|
327
201
|
// * when autocomplete select mode not reset input value
|
|
328
|
-
!isSelectedFromAutocompleteRef.current
|
|
329
|
-
|
|
330
|
-
inputRef.current.value.length > 0) {
|
|
331
|
-
updateInputValue('');
|
|
202
|
+
if (!isSelectedFromAutocompleteRef.current) {
|
|
203
|
+
clearInput();
|
|
332
204
|
}
|
|
205
|
+
blurTags();
|
|
333
206
|
isSelectedFromAutocompleteRef.current = false;
|
|
207
|
+
noOptionItemRef.current = null;
|
|
334
208
|
isInputValueChangedRef.current = false;
|
|
335
|
-
setActiveIndex(-1);
|
|
336
209
|
if (!disableCloseOnSelect) {
|
|
337
210
|
closeMenu(e, 'select-option');
|
|
338
211
|
}
|
|
339
212
|
};
|
|
340
213
|
var reset = function (isFocus) {
|
|
341
214
|
resetState();
|
|
342
|
-
setIsTagsFocus(false);
|
|
343
|
-
onInputChangeProp === null || onInputChangeProp === void 0 ? void 0 : onInputChangeProp('');
|
|
344
215
|
onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange([]);
|
|
345
|
-
|
|
346
|
-
focusInput();
|
|
216
|
+
resetSuggestionList(isFocus);
|
|
347
217
|
};
|
|
348
|
-
var activeIndexRef = react_1.useRef(activeIndex);
|
|
349
|
-
activeIndexRef.current = activeIndex;
|
|
350
|
-
var handleTagKey = foundation_1.useKeyboardMoveFocus({
|
|
351
|
-
options: selectedItems,
|
|
352
|
-
focusedIndexRef: activeIndexRef,
|
|
353
|
-
infinite: 'order',
|
|
354
|
-
onFocusedIndexChange: function (event, toIndex) {
|
|
355
|
-
handleFocusTag(toIndex);
|
|
356
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
357
|
-
},
|
|
358
|
-
}).onKeyFocusedIndexHandle;
|
|
359
|
-
var _o = foundation_1.useKeyboardMoveFocus({
|
|
360
|
-
options: optionItems,
|
|
361
|
-
focusedIndexRef: highlightedIndexRef,
|
|
362
|
-
infinite: true,
|
|
363
|
-
onFocusedIndexChange: function (event, toIndex) {
|
|
364
|
-
setHighlightedIndex(toIndex, { reason: 'keyboard', reRender: true });
|
|
365
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
366
|
-
},
|
|
367
|
-
getOptionDisabled: disabledItemsHighlightable
|
|
368
|
-
? undefined
|
|
369
|
-
: function (child) {
|
|
370
|
-
return !getIsItemCanSelected(child);
|
|
371
|
-
},
|
|
372
|
-
}), onKeyFocusedIndexHandle = _o.onKeyFocusedIndexHandle, getNextFocusableOption = _o.getNextFocusableOption;
|
|
373
218
|
var keepHighlightedIndex = function () {
|
|
374
219
|
keepHighlightedIndexRef.current = true;
|
|
375
220
|
};
|
|
@@ -388,8 +233,8 @@ exports.useDownshift = function (_a) {
|
|
|
388
233
|
if (isOpen) {
|
|
389
234
|
if (highlightedIndexRef.current === DEFAULT_HIGHLIGHTED_INDEX) {
|
|
390
235
|
var toIndex = defaultHighlightedIndex;
|
|
391
|
-
if (isAutocomplete &&
|
|
392
|
-
var itemText_1 = getOptionLabel(
|
|
236
|
+
if (isAutocomplete && tags.length === 1) {
|
|
237
|
+
var itemText_1 = getOptionLabel(tags[0]);
|
|
393
238
|
var fIndex = optionItems.findIndex(function (x) { return getOptionLabel(x) === itemText_1; });
|
|
394
239
|
if (fIndex > -1) {
|
|
395
240
|
toIndex = fIndex;
|
|
@@ -411,8 +256,8 @@ exports.useDownshift = function (_a) {
|
|
|
411
256
|
}
|
|
412
257
|
}
|
|
413
258
|
var handleAutocompleteText = function () {
|
|
414
|
-
if (isAutocomplete &&
|
|
415
|
-
var result = getOptionLabel(
|
|
259
|
+
if (isAutocomplete && tags.length > 0) {
|
|
260
|
+
var result = getOptionLabel(tags[0]);
|
|
416
261
|
onInputChangeProp === null || onInputChangeProp === void 0 ? void 0 : onInputChangeProp(result);
|
|
417
262
|
}
|
|
418
263
|
};
|
|
@@ -424,103 +269,9 @@ exports.useDownshift = function (_a) {
|
|
|
424
269
|
handleAutocompleteText();
|
|
425
270
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
426
271
|
}, []);
|
|
427
|
-
/**
|
|
428
|
-
* All Get props methods
|
|
429
|
-
*/
|
|
430
|
-
var getTagListBoxProps = function (props) {
|
|
431
|
-
return tslib_1.__assign({ 'aria-label': isString_1.default(labelProp) ? labelProp : undefined, 'aria-required': required || false, 'aria-disabled': disabled || false }, props);
|
|
432
|
-
};
|
|
433
|
-
var getItemProps = function (_a) {
|
|
434
|
-
var item = _a.item, index = _a.index, itemRest = tslib_1.__rest(_a, ["item", "index"]);
|
|
435
|
-
return foundation_1.combineProps({
|
|
436
|
-
id: downshiftId + "-option-" + index,
|
|
437
|
-
role: 'option',
|
|
438
|
-
onClick: function (e) {
|
|
439
|
-
selectItemFn(item, e);
|
|
440
|
-
},
|
|
441
|
-
onMouseDown: function (e) {
|
|
442
|
-
e.preventDefault();
|
|
443
|
-
e.stopPropagation();
|
|
444
|
-
},
|
|
445
|
-
onMouseOver: function () {
|
|
446
|
-
if (highlightedIndexRef.current !== index) {
|
|
447
|
-
setHighlightedIndex(index, { reason: 'mouse', reRender: true });
|
|
448
|
-
}
|
|
449
|
-
},
|
|
450
|
-
}, itemRest);
|
|
451
|
-
};
|
|
452
|
-
var getTagProps = function (_a) {
|
|
453
|
-
var index = _a.index, selectedItem = _a.selectedItem, restTagProps = tslib_1.__rest(_a, ["index", "selectedItem"]);
|
|
454
|
-
var tabIndex =
|
|
455
|
-
// * when tag is not focus
|
|
456
|
-
!isTagsFocus &&
|
|
457
|
-
// * and is first item
|
|
458
|
-
index === 0
|
|
459
|
-
? 0
|
|
460
|
-
: -1;
|
|
461
|
-
return foundation_1.combineProps({
|
|
462
|
-
tabIndex: tabIndex,
|
|
463
|
-
// TODO: wait for input can complete that.
|
|
464
|
-
// role: 'option',
|
|
465
|
-
role: 'button',
|
|
466
|
-
key: downshiftId + "-selected-item-" + index,
|
|
467
|
-
'data-tag-index': index,
|
|
468
|
-
'data-item-last': index === selectedItems.length - 1,
|
|
469
|
-
onClick: function (e) {
|
|
470
|
-
e.stopPropagation();
|
|
471
|
-
},
|
|
472
|
-
onBlur: function () { return setIsTagsFocus(false); },
|
|
473
|
-
onFocus: function () {
|
|
474
|
-
handleFocusTag(index);
|
|
475
|
-
setIsTagsFocus(true);
|
|
476
|
-
},
|
|
477
|
-
onKeyDown: function (e) {
|
|
478
|
-
switch (e.key) {
|
|
479
|
-
case 'Backspace':
|
|
480
|
-
{
|
|
481
|
-
var lengthBeforeDelete = selectedItems.length;
|
|
482
|
-
handleFocusTag(
|
|
483
|
-
// * when length is 1 mean that will be remove all
|
|
484
|
-
lengthBeforeDelete === 1
|
|
485
|
-
? -1
|
|
486
|
-
: activeIndex === 0
|
|
487
|
-
? 0
|
|
488
|
-
: activeIndex - 1);
|
|
489
|
-
removeSelectedItem(selectedItem);
|
|
490
|
-
}
|
|
491
|
-
break;
|
|
492
|
-
case 'Delete':
|
|
493
|
-
{
|
|
494
|
-
var lengthBeforeDelete = selectedItems.length;
|
|
495
|
-
handleFocusTag(
|
|
496
|
-
// * when length is 1 mean that will be remove all
|
|
497
|
-
lengthBeforeDelete === 1
|
|
498
|
-
? -1
|
|
499
|
-
: activeIndex === selectedItems.length - 1
|
|
500
|
-
? activeIndex - 1
|
|
501
|
-
: activeIndex);
|
|
502
|
-
removeSelectedItem(selectedItem);
|
|
503
|
-
}
|
|
504
|
-
break;
|
|
505
|
-
default:
|
|
506
|
-
handleTagKey(e);
|
|
507
|
-
break;
|
|
508
|
-
}
|
|
509
|
-
},
|
|
510
|
-
onDelete: function (e) {
|
|
511
|
-
// * left button clicked
|
|
512
|
-
if (e.button === 0) {
|
|
513
|
-
removeSelectedItem(selectedItem);
|
|
514
|
-
setIsTagsFocus(false);
|
|
515
|
-
}
|
|
516
|
-
},
|
|
517
|
-
}, restTagProps);
|
|
518
|
-
};
|
|
519
272
|
var getInputProps = function (props) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
autoComplete: 'off',
|
|
523
|
-
onPaste: function (e) {
|
|
273
|
+
var suggestionListItemProps = getSuggestionListInputProps(props);
|
|
274
|
+
return foundation_1.combineProps(tslib_1.__assign(tslib_1.__assign({}, suggestionListItemProps), { onPaste: function (e) {
|
|
524
275
|
var _a;
|
|
525
276
|
if (freeSolo) {
|
|
526
277
|
var clipboardData = e.clipboardData;
|
|
@@ -535,20 +286,18 @@ exports.useDownshift = function (_a) {
|
|
|
535
286
|
pasteText +
|
|
536
287
|
currText.slice(position.end);
|
|
537
288
|
}
|
|
538
|
-
},
|
|
539
|
-
onChange: function (e) {
|
|
289
|
+
}, onChange: function (e) {
|
|
540
290
|
var changeValue = fromPasteString.current || e.target.value;
|
|
541
291
|
handleInputChange(changeValue, undefined, e);
|
|
542
292
|
// * when input value clear all, clear selected item
|
|
543
293
|
if (isAutocomplete && changeValue.length === 0) {
|
|
544
|
-
|
|
294
|
+
clearTags();
|
|
545
295
|
}
|
|
546
296
|
fromPasteString.current = '';
|
|
547
297
|
isInputValueChangedRef.current = true;
|
|
548
|
-
},
|
|
549
|
-
onFocus: function (e) {
|
|
298
|
+
}, onFocus: function (e) {
|
|
550
299
|
var _a;
|
|
551
|
-
|
|
300
|
+
setInputFocused(true);
|
|
552
301
|
if (openOnFocus)
|
|
553
302
|
openMenu(e);
|
|
554
303
|
// * when autocomplete mode, always select all text when focus
|
|
@@ -557,25 +306,20 @@ exports.useDownshift = function (_a) {
|
|
|
557
306
|
}
|
|
558
307
|
// * reset stopAutoSelect in focus input
|
|
559
308
|
stopAutoSelectRef.current = false;
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
},
|
|
564
|
-
onBlur: function (e) {
|
|
565
|
-
setIsFocused(false);
|
|
309
|
+
blurTags();
|
|
310
|
+
}, onBlur: function (e) {
|
|
311
|
+
setInputFocused(false);
|
|
566
312
|
if (autoSelect && !stopAutoSelectRef.current) {
|
|
567
313
|
if (!freeSolo)
|
|
568
|
-
|
|
314
|
+
selectItem(e, optionItems[highlightedIndexRef.current]);
|
|
569
315
|
checkAndAddFreeSolo({}, e);
|
|
570
316
|
}
|
|
571
317
|
// * when blur should restore text when have selected item
|
|
572
318
|
handleAutocompleteText();
|
|
573
319
|
closeMenu(e, 'blur');
|
|
574
|
-
},
|
|
575
|
-
onCompositionStart: function () {
|
|
320
|
+
}, onCompositionStart: function () {
|
|
576
321
|
isCompositionRef.current = true;
|
|
577
|
-
},
|
|
578
|
-
onCompositionEnd: function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
322
|
+
}, onCompositionEnd: function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
579
323
|
return tslib_1.__generator(this, function (_a) {
|
|
580
324
|
switch (_a.label) {
|
|
581
325
|
case 0:
|
|
@@ -588,20 +332,17 @@ exports.useDownshift = function (_a) {
|
|
|
588
332
|
return [2 /*return*/];
|
|
589
333
|
}
|
|
590
334
|
});
|
|
591
|
-
}); },
|
|
592
|
-
onKeyDown: function (e) {
|
|
335
|
+
}); }, onKeyDown: function (e) {
|
|
593
336
|
keepHighlightedIndexRef.current = false;
|
|
594
337
|
onKeyDownProp === null || onKeyDownProp === void 0 ? void 0 : onKeyDownProp(e, highlightedIndexRef.current);
|
|
595
338
|
var _a = foundation_1.getSelectionPosition(inputRef), isSelectRange = _a.isSelectRange, position = _a.position;
|
|
596
|
-
var currTagsLength =
|
|
339
|
+
var currTagsLength = tags.length;
|
|
597
340
|
if (!isSelectRange &&
|
|
598
341
|
position.start === 0 &&
|
|
599
342
|
currTagsLength > 0 &&
|
|
600
343
|
e.key === 'Backspace') {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
handleFocusTag(currTagsLength - 1);
|
|
604
|
-
}
|
|
344
|
+
stopAutoSelectRef.current = true;
|
|
345
|
+
focusLastTag();
|
|
605
346
|
}
|
|
606
347
|
else {
|
|
607
348
|
var highlightedIndex = highlightedIndexRef.current;
|
|
@@ -633,7 +374,7 @@ exports.useDownshift = function (_a) {
|
|
|
633
374
|
if (!e.shiftKey && !isCompositionRef.current) {
|
|
634
375
|
var currentHighlightItem = optionItems[highlightedIndex];
|
|
635
376
|
if (isOpen && currentHighlightItem) {
|
|
636
|
-
if (
|
|
377
|
+
if (selectItem(e, currentHighlightItem)) {
|
|
637
378
|
e.preventDefault();
|
|
638
379
|
e.stopPropagation();
|
|
639
380
|
}
|
|
@@ -660,20 +401,14 @@ exports.useDownshift = function (_a) {
|
|
|
660
401
|
else if (highlightedIndex !== DEFAULT_HIGHLIGHTED_INDEX &&
|
|
661
402
|
isOpen &&
|
|
662
403
|
!isCompositionRef.current) {
|
|
663
|
-
|
|
404
|
+
selectItem(e, optionItems[highlightedIndex]);
|
|
664
405
|
e.stopPropagation();
|
|
665
406
|
}
|
|
666
407
|
// always preventDefault for not inset all enter into textarea
|
|
667
408
|
e.preventDefault();
|
|
668
409
|
break;
|
|
669
410
|
case 'F10':
|
|
670
|
-
|
|
671
|
-
var currOption = optionItems[highlightedIndex];
|
|
672
|
-
var currentGroup = currOption.group;
|
|
673
|
-
if (currentGroup && currentGroup.options.length > 1) {
|
|
674
|
-
handleGroupExpandedChange(currentGroup.group);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
411
|
+
handleF10KeyDown(e);
|
|
677
412
|
break;
|
|
678
413
|
case 'ArrowUp':
|
|
679
414
|
case 'ArrowDown':
|
|
@@ -682,7 +417,7 @@ exports.useDownshift = function (_a) {
|
|
|
682
417
|
return;
|
|
683
418
|
}
|
|
684
419
|
// * check state for is that should move key in option items
|
|
685
|
-
if (isAutocomplete &&
|
|
420
|
+
if (isAutocomplete && tags.length > 0 && !isOpen) {
|
|
686
421
|
openMenu(e);
|
|
687
422
|
e.preventDefault();
|
|
688
423
|
break;
|
|
@@ -697,30 +432,11 @@ exports.useDownshift = function (_a) {
|
|
|
697
432
|
break;
|
|
698
433
|
}
|
|
699
434
|
}
|
|
700
|
-
},
|
|
701
|
-
}, props);
|
|
435
|
+
} }), props);
|
|
702
436
|
};
|
|
703
437
|
var getInputAriaProps = function (props) {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
// * provide for when container click focus on input
|
|
707
|
-
onContainerClick: focusInput,
|
|
708
|
-
unselectable: readOnly ? 'on' : undefined,
|
|
709
|
-
role: 'combobox',
|
|
710
|
-
'aria-autocomplete': 'list',
|
|
711
|
-
'aria-expanded': !!isOpen,
|
|
712
|
-
'aria-haspopup': true,
|
|
713
|
-
'aria-owns': isOpen ? downshiftId + "-menu" : undefined,
|
|
714
|
-
'aria-activedescendant': isOpen && highlightedIndexRef.current > -1
|
|
715
|
-
? downshiftId + "-option-" + highlightedIndexRef.current
|
|
716
|
-
: undefined,
|
|
717
|
-
}, props);
|
|
718
|
-
};
|
|
719
|
-
var getLabelProps = function (props) {
|
|
720
|
-
return foundation_1.combineProps({
|
|
721
|
-
htmlFor: downshiftId + "-input",
|
|
722
|
-
id: downshiftId + "-label",
|
|
723
|
-
}, props);
|
|
438
|
+
var suggestionListInputAriaProps = getSuggestionListInputAriaProps(props);
|
|
439
|
+
return foundation_1.combineProps(tslib_1.__assign(tslib_1.__assign({}, suggestionListInputAriaProps), { readOnly: readOnly, unselectable: readOnly ? 'on' : undefined, 'aria-owns': isOpen ? downshiftId + "-menu" : undefined, 'aria-expanded': !!isOpen }), props);
|
|
724
440
|
};
|
|
725
441
|
var getPopperProps = function (restPopperProps) {
|
|
726
442
|
var _a;
|
|
@@ -734,13 +450,6 @@ exports.useDownshift = function (_a) {
|
|
|
734
450
|
},
|
|
735
451
|
}, restPopperProps);
|
|
736
452
|
};
|
|
737
|
-
var getMenuProps = function (restMenuProps) {
|
|
738
|
-
return foundation_1.combineProps({
|
|
739
|
-
'aria-labelledby': downshiftId + "-label",
|
|
740
|
-
id: downshiftId + "-menu",
|
|
741
|
-
role: 'listbox',
|
|
742
|
-
}, restMenuProps);
|
|
743
|
-
};
|
|
744
453
|
var getToggleButtonProps = function (props) {
|
|
745
454
|
return foundation_1.combineProps({
|
|
746
455
|
disabled: (!isOpen && optionItems.length === 0) || disabled || readOnly,
|
|
@@ -762,13 +471,11 @@ exports.useDownshift = function (_a) {
|
|
|
762
471
|
}, props);
|
|
763
472
|
};
|
|
764
473
|
var getClearButtonProps = function (props) {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
onClick: function (e) {
|
|
474
|
+
var suggestionListClearButtonProps = getSuggestionListClearButtonProps(props);
|
|
475
|
+
return foundation_1.combineProps(tslib_1.__assign(tslib_1.__assign({}, suggestionListClearButtonProps), { onClick: function (e) {
|
|
768
476
|
onClear === null || onClear === void 0 ? void 0 : onClear(e);
|
|
769
477
|
reset(true);
|
|
770
|
-
},
|
|
771
|
-
}, props);
|
|
478
|
+
} }), props);
|
|
772
479
|
};
|
|
773
480
|
var getNoOptionsProps = function (additionProps) {
|
|
774
481
|
return foundation_1.combineProps({
|
|
@@ -778,17 +485,14 @@ exports.useDownshift = function (_a) {
|
|
|
778
485
|
role: 'presentation',
|
|
779
486
|
}, additionProps);
|
|
780
487
|
};
|
|
781
|
-
|
|
488
|
+
return {
|
|
782
489
|
focusInput: focusInput,
|
|
783
|
-
setIsTagsFocus: setIsTagsFocus,
|
|
784
490
|
readOnly: readOnly,
|
|
785
491
|
getTagProps: getTagProps,
|
|
786
492
|
getClearButtonProps: getClearButtonProps,
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
setActiveIndex: handleFocusTag,
|
|
493
|
+
activeIndex: focusedTagIndex,
|
|
494
|
+
setActiveIndex: focusTag,
|
|
790
495
|
isOpen: isOpen,
|
|
791
|
-
isTagsFocus: isTagsFocus,
|
|
792
496
|
getToggleButtonProps: getToggleButtonProps,
|
|
793
497
|
getPopperProps: getPopperProps,
|
|
794
498
|
getLabelProps: getLabelProps,
|
|
@@ -800,23 +504,22 @@ exports.useDownshift = function (_a) {
|
|
|
800
504
|
getNoOptionsProps: getNoOptionsProps,
|
|
801
505
|
noOptionItem: noOptionItemRef.current,
|
|
802
506
|
highlightedIndex: highlightedIndexRef.current,
|
|
803
|
-
|
|
507
|
+
tags: tags,
|
|
804
508
|
optionItems: optionItems,
|
|
805
509
|
inputValue: inputValue,
|
|
806
510
|
onInputChange: handleInputChange,
|
|
807
511
|
keepHighlightedIndex: keepHighlightedIndex,
|
|
808
512
|
isKeepHighlightedIndex: keepHighlightedIndexRef.current,
|
|
809
513
|
setHighlightedIndex: setHighlightedIndex,
|
|
810
|
-
changeHighlightedIndexReason:
|
|
514
|
+
changeHighlightedIndexReason: changeHighlightedIndexReasonRef.current,
|
|
811
515
|
closeMenu: closeMenu,
|
|
812
516
|
openMenu: openMenu,
|
|
813
517
|
reset: reset,
|
|
814
518
|
forceUpdate: forceUpdate,
|
|
815
519
|
optionsGroupList: optionsGroupList,
|
|
816
|
-
|
|
520
|
+
/** that state of current downshift focused, both tag or input focused */
|
|
521
|
+
focused: focused !== null && focused !== void 0 ? focused : (tagFocused || inputFocused ? true : undefined),
|
|
817
522
|
id: downshiftId,
|
|
818
523
|
inputChanged: isInputValueChangedRef.current,
|
|
819
524
|
};
|
|
820
|
-
changeHighlightedIndexReason.current = undefined;
|
|
821
|
-
return resultObj;
|
|
822
525
|
};
|