@zohodesk/dot 1.2.1 → 1.2.3
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/.cli/PropLessFiles.html +1 -1
- package/.cli/propValidation_report.html +1 -1
- package/README.md +15 -0
- package/coverage/ExternalLink/ExternalLink.js.html +1 -1
- package/coverage/ExternalLink/ExternalLink.module.css.html +1 -1
- package/coverage/ExternalLink/index.html +1 -1
- package/coverage/ExternalLink/props/defaultProps.js.html +1 -1
- package/coverage/ExternalLink/props/index.html +1 -1
- package/coverage/ExternalLink/props/propTypes.js.html +1 -1
- package/coverage/Image/Image.js.html +1 -1
- package/coverage/Image/Image.module.css.html +1 -1
- package/coverage/Image/index.html +1 -1
- package/coverage/Image/props/defaultProps.js.html +1 -1
- package/coverage/Image/props/index.html +1 -1
- package/coverage/Image/props/propTypes.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.module.css.html +1 -1
- package/coverage/avatar/AvatarWithTeam/index.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/defaultProps.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/index.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/propTypes.js.html +1 -1
- package/coverage/index.html +1 -1
- package/es/Attachment/Attachment.js +2 -1
- package/es/Attachment/Attachment.module.css +10 -6
- package/es/Link/Link.js +2 -1
- package/es/TagWithIcon/props/propTypes.js +1 -1
- package/es/dropdown/ToggleDropDown/ToggleDropDown.js +5 -2
- package/es/emptystate/CommonEmptyState/CommonEmptyState.js +1 -0
- package/es/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +7 -3
- package/es/layout/SubtabLayout/props/propTypes.js +1 -1
- package/es/list/Icons/AddNewIcon.js +3 -2
- package/es/list/Icons/CompleteIcon.js +3 -2
- package/es/list/Icons/DeleteIcon.js +4 -3
- package/es/list/Icons/EditIcon.js +5 -3
- package/es/list/Icons/ReadUnreadIcon.js +5 -3
- package/es/list/Icons/SmartIcon.js +5 -3
- package/es/list/ListLayout/ListLayout.module.css +24 -8
- package/es/list/listCommon.module.css +23 -5
- package/es/list/status/StatusDropdown/StatusDropdown.js +16 -3
- package/es/list/status/StatusDropdown/props/propTypes.js +2 -1
- package/es/lookup/Lookup/Lookup.js +2 -0
- package/es/lookup/header/ViewDropDown/ViewDropDown.js +2 -1
- package/es/setup/helptips/ListGroup/ListGroup.js +1 -1
- package/es/v1/Attachment/Attachment.js +88 -0
- package/es/v1/AttachmentViewer/AttachmentImage.js +79 -0
- package/es/v1/AttachmentViewer/AttachmentViewer.js +541 -0
- package/es/v1/ChannelIcon/ChannelIcon.js +1 -1
- package/es/v1/Drawer/Drawer.js +1 -1
- package/es/v1/FlipCard/FlipCard.js +3 -3
- package/es/v1/FreezeLayer/FreezeLayer.js +74 -0
- package/es/v1/Image/Image.js +39 -0
- package/es/v1/Link/Link.js +2 -1
- package/es/v1/Loader/Loader.js +21 -0
- package/es/v1/Message/Message.js +118 -0
- package/es/v1/MessageBanner/MessageBanner.js +1 -1
- package/es/v1/PlusIcon/PlusIcon.js +44 -0
- package/es/v1/Separator/Separator.js +60 -0
- package/es/v1/ToastMessage/ToastMessage.js +203 -0
- package/es/v1/Upload/Upload.js +76 -0
- package/es/v1/actions/AutoClose.js +43 -0
- package/es/v1/alert/index.js +2 -0
- package/es/v1/avatar/AvatarClose/AvatarClose.js +53 -0
- package/es/v1/avatar/AvatarCollision/AvatarCollision.js +62 -0
- package/es/v1/avatar/AvatarIcon/AvatarIcon.js +54 -0
- package/es/v1/avatar/AvatarStatus/AvatarStatus.js +72 -0
- package/es/v1/avatar/AvatarThread/AvatarThread.js +79 -0
- package/es/v1/avatar/AvatarUser/AvatarUser.js +116 -0
- package/es/v1/avatar/AvatarWithTeam/AvatarWithTeam.js +98 -0
- package/es/v1/avatar/index.js +7 -0
- package/es/v1/dropdown/ToggleDropDown/ToggleDropDown.js +861 -0
- package/es/v1/emptystate/CommonEmptyState/CommonEmptyState.js +1 -0
- package/es/v1/errorstate/Inconvenience/Inconvenience.js +86 -0
- package/es/v1/errorstate/LinkText/LinkText.js +29 -0
- package/es/v1/errorstate/NoRequestFound/NoRequestFound.js +84 -0
- package/es/v1/errorstate/PermissionPlay/PermissionPlay.js +83 -0
- package/es/v1/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +84 -0
- package/es/v1/errorstate/UnableToProcess/UnableToProcess.js +86 -0
- package/es/v1/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +84 -0
- package/es/v1/errorstate/WillBack/WillBack.js +75 -0
- package/es/v1/errorstate/index.js +8 -0
- package/es/v1/form/fields/CheckBoxField/CheckBoxField.js +141 -0
- package/es/v1/form/fields/CurrencyField/CurrencyField.js +183 -0
- package/es/v1/form/fields/DateField/DateField.js +195 -0
- package/es/v1/form/fields/FieldContainer/FieldContainer.js +71 -0
- package/es/v1/form/fields/MultiSelectField/MultiSelectField.js +213 -0
- package/es/v1/form/fields/PhoneField/PhoneField.js +189 -0
- package/es/v1/form/fields/RadioField/RadioField.js +116 -0
- package/es/v1/form/fields/SelectField/SelectField.js +183 -0
- package/es/v1/form/fields/TagsMultiSelect/TagsMultiSelect.js +292 -0
- package/es/v1/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +258 -0
- package/es/v1/form/fields/TextBoxField/TextBoxField.js +164 -0
- package/es/v1/form/fields/TextEditor/TextEditor.js +418 -0
- package/es/v1/form/fields/TextEditorField/TextEditorField.js +178 -0
- package/es/v1/form/fields/TextEditorWrapper/TextEditorWrapper.js +203 -0
- package/es/v1/form/fields/TextareaField/TextareaField.js +161 -0
- package/es/v1/form/fields/ValidationMessage/ValidationMessage.js +58 -0
- package/es/v1/form/fields/index.js +16 -0
- package/es/v1/form/layout/Field/Field.js +33 -0
- package/es/v1/form/layout/Section/Section.js +37 -0
- package/es/v1/form/layout/index.js +2 -0
- package/es/v1/layout/SetupDetailLayout/SetupDetailLayout.js +217 -0
- package/es/v1/layout/SetupDetailLayout/index.js +4 -0
- package/es/v1/layout/SubtabLayout/SubtabLayout.js +144 -0
- package/es/v1/layout/SubtabLayout/index.js +4 -0
- package/es/v1/list/AvatarFlip/AvatarFlip.js +76 -0
- package/es/v1/list/BluePrintStatus/BluePrintStatus.js +28 -0
- package/es/v1/list/Comment/Comment.js +45 -0
- package/es/v1/list/DepartmentDropDown/DepartmentDropDown.js +100 -0
- package/es/v1/list/Dot/Dot.js +22 -0
- package/es/v1/list/DotNew/DotNew.js +29 -0
- package/es/v1/list/GridStencils/GridStencils.js +34 -0
- package/es/v1/list/Icons/AddNewIcon.js +28 -0
- package/es/v1/list/Icons/CompleteIcon.js +30 -0
- package/es/v1/list/Icons/DeleteIcon.js +31 -0
- package/es/v1/list/Icons/EditIcon.js +31 -0
- package/es/v1/list/Icons/FloatingIcons.js +30 -0
- package/es/v1/list/Icons/ReadUnreadIcon.js +35 -0
- package/es/v1/list/Icons/SmartIcon.js +28 -0
- package/es/v1/list/Icons/index.js +7 -0
- package/es/v1/list/ListLayout/ListLayout.js +83 -0
- package/es/v1/list/ListStencils/ListStencils.js +47 -0
- package/es/v1/list/SecondaryText/AccountName.js +85 -0
- package/es/v1/list/SecondaryText/ContactName.js +85 -0
- package/es/v1/list/SecondaryText/DepartmentText.js +30 -0
- package/es/v1/list/SecondaryText/Email.js +55 -0
- package/es/v1/list/SecondaryText/HappinessRating.js +31 -0
- package/es/v1/list/SecondaryText/PhoneNumber.js +59 -0
- package/es/v1/list/SecondaryText/PriorityText.js +33 -0
- package/es/v1/list/SecondaryText/SecondaryText.js +40 -0
- package/es/v1/list/SecondaryText/StatusText.js +34 -0
- package/es/v1/list/SecondaryText/TicketId.js +53 -0
- package/es/v1/list/SecondaryText/Website.js +43 -0
- package/es/v1/list/SecondaryText/index.js +11 -0
- package/es/v1/list/SecondryPanel/SecondryPanel.js +105 -0
- package/es/v1/list/SentimentStatus/SentimentStatus.js +34 -0
- package/es/v1/list/Subject/Subject.js +57 -0
- package/es/v1/list/TagNew/TagNew.js +33 -0
- package/es/v1/list/Thread/Thread.js +43 -0
- package/es/v1/list/UserTime/UserTime.js +83 -0
- package/es/v1/list/index.js +17 -0
- package/es/v1/list/status/StatusDropdown/StatusDropdown.js +465 -0
- package/es/v1/list/status/StatusListItem/StatusListItem.js +122 -0
- package/es/v1/list/status/index.js +2 -0
- package/es/v1/lookup/EmptyPage/EmptyPage.js +65 -0
- package/es/v1/lookup/Lookup/Lookup.js +2 -0
- package/es/v1/lookup/Section/Section.js +25 -0
- package/es/v1/lookup/header/ViewDropDown/ViewDropDown.js +176 -0
- package/es/v1/lookup/header/index.js +5 -0
- package/es/v1/setup/header/Button/Button.js +36 -0
- package/es/v1/setup/header/Link/Link.js +44 -0
- package/es/v1/setup/header/Search/Search.js +81 -0
- package/es/v1/setup/header/Views/Views.js +46 -0
- package/es/v1/setup/header/index.js +4 -0
- package/es/v1/setup/helptips/Description/Description.js +24 -0
- package/es/v1/setup/helptips/Link/Link.js +41 -0
- package/es/v1/setup/helptips/ListGroup/ListGroup.js +39 -0
- package/es/v1/setup/helptips/Title/Title.js +24 -0
- package/es/v1/setup/helptips/index.js +4 -0
- package/es/v1/setup/index.js +6 -0
- package/es/v1/setup/table/index.js +5 -0
- package/es/v1/svg/PlusIcon.js +32 -0
- package/es/v1/svg/SnippetIcon.js +34 -0
- package/es/v1/svg/TemplateIcon.js +35 -0
- package/es/v1/svg/index.js +3 -0
- package/es/v1/version2/alertIcons/index.js +8 -0
- package/es/v1/version2/index.js +12 -0
- package/es/v1/version2/lookup/AlertHeader/AlertHeader.js +79 -0
- package/es/v1/version2/lookup/AlertLookup/AlertLookup.js +17 -5
- package/es/v1/version2/notification/DesktopNotification/DesktopNotification.js +164 -0
- package/es/version2/lookup/AlertLookup/AlertLookup.js +14 -2
- package/lib/Attachment/Attachment.js +2 -1
- package/lib/Attachment/Attachment.module.css +10 -6
- package/lib/Link/Link.js +2 -1
- package/lib/TagWithIcon/props/propTypes.js +1 -1
- package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +5 -3
- package/lib/emptystate/CommonEmptyState/CommonEmptyState.js +1 -0
- package/lib/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +8 -5
- package/lib/layout/SubtabLayout/props/propTypes.js +1 -1
- package/lib/list/Icons/AddNewIcon.js +4 -2
- package/lib/list/Icons/CompleteIcon.js +4 -2
- package/lib/list/Icons/DeleteIcon.js +5 -3
- package/lib/list/Icons/EditIcon.js +6 -3
- package/lib/list/Icons/ReadUnreadIcon.js +6 -3
- package/lib/list/Icons/SmartIcon.js +6 -3
- package/lib/list/ListLayout/ListLayout.module.css +24 -8
- package/lib/list/listCommon.module.css +23 -5
- package/lib/list/status/StatusDropdown/StatusDropdown.js +16 -5
- package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/lib/lookup/Lookup/Lookup.js +2 -0
- package/lib/lookup/header/ViewDropDown/ViewDropDown.js +2 -1
- package/lib/setup/helptips/ListGroup/ListGroup.js +1 -1
- package/lib/v1/Attachment/Attachment.js +140 -0
- package/lib/v1/AttachmentViewer/AttachmentImage.js +124 -0
- package/lib/v1/AttachmentViewer/AttachmentViewer.js +625 -0
- package/lib/v1/ChannelIcon/ChannelIcon.js +1 -1
- package/lib/v1/Drawer/Drawer.js +1 -1
- package/lib/v1/FlipCard/FlipCard.js +3 -3
- package/lib/v1/FreezeLayer/FreezeLayer.js +94 -0
- package/lib/v1/Image/Image.js +89 -0
- package/lib/v1/Link/Link.js +2 -1
- package/lib/v1/Loader/Loader.js +70 -0
- package/lib/v1/Message/Message.js +170 -0
- package/lib/v1/MessageBanner/MessageBanner.js +1 -1
- package/lib/v1/PlusIcon/PlusIcon.js +91 -0
- package/lib/v1/Separator/Separator.js +107 -0
- package/lib/v1/ToastMessage/ToastMessage.js +246 -0
- package/lib/v1/Upload/Upload.js +128 -0
- package/lib/v1/actions/AutoClose.js +75 -0
- package/lib/v1/alert/index.js +23 -0
- package/lib/v1/avatar/AvatarClose/AvatarClose.js +101 -0
- package/lib/v1/avatar/AvatarCollision/AvatarCollision.js +110 -0
- package/lib/v1/avatar/AvatarIcon/AvatarIcon.js +106 -0
- package/lib/v1/avatar/AvatarStatus/AvatarStatus.js +119 -0
- package/lib/v1/avatar/AvatarThread/AvatarThread.js +130 -0
- package/lib/v1/avatar/AvatarUser/AvatarUser.js +167 -0
- package/lib/v1/avatar/AvatarWithTeam/AvatarWithTeam.js +154 -0
- package/lib/v1/avatar/index.js +63 -0
- package/lib/v1/dropdown/ToggleDropDown/ToggleDropDown.js +932 -0
- package/lib/v1/emptystate/CommonEmptyState/CommonEmptyState.js +1 -0
- package/lib/v1/errorstate/Inconvenience/Inconvenience.js +137 -0
- package/lib/v1/errorstate/LinkText/LinkText.js +80 -0
- package/lib/v1/errorstate/NoRequestFound/NoRequestFound.js +135 -0
- package/lib/v1/errorstate/PermissionPlay/PermissionPlay.js +134 -0
- package/lib/v1/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +135 -0
- package/lib/v1/errorstate/UnableToProcess/UnableToProcess.js +137 -0
- package/lib/v1/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +135 -0
- package/lib/v1/errorstate/WillBack/WillBack.js +125 -0
- package/lib/v1/errorstate/index.js +71 -0
- package/lib/v1/form/fields/CheckBoxField/CheckBoxField.js +197 -0
- package/lib/v1/form/fields/CurrencyField/CurrencyField.js +234 -0
- package/lib/v1/form/fields/DateField/DateField.js +249 -0
- package/lib/v1/form/fields/FieldContainer/FieldContainer.js +118 -0
- package/lib/v1/form/fields/MultiSelectField/MultiSelectField.js +268 -0
- package/lib/v1/form/fields/PhoneField/PhoneField.js +236 -0
- package/lib/v1/form/fields/RadioField/RadioField.js +169 -0
- package/lib/v1/form/fields/SelectField/SelectField.js +236 -0
- package/lib/v1/form/fields/TagsMultiSelect/TagsMultiSelect.js +346 -0
- package/lib/v1/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +299 -0
- package/lib/v1/form/fields/TextBoxField/TextBoxField.js +219 -0
- package/lib/v1/form/fields/TextEditor/TextEditor.js +463 -0
- package/lib/v1/form/fields/TextEditorField/TextEditorField.js +230 -0
- package/lib/v1/form/fields/TextEditorWrapper/TextEditorWrapper.js +256 -0
- package/lib/v1/form/fields/TextareaField/TextareaField.js +215 -0
- package/lib/v1/form/fields/ValidationMessage/ValidationMessage.js +110 -0
- package/lib/{docs/formDocs.js → v1/form/fields/index.js} +33 -25
- package/lib/v1/form/layout/Field/Field.js +87 -0
- package/lib/v1/form/layout/Section/Section.js +86 -0
- package/lib/v1/form/layout/index.js +23 -0
- package/lib/v1/layout/SetupDetailLayout/SetupDetailLayout.js +305 -0
- package/lib/v1/layout/SetupDetailLayout/index.js +37 -0
- package/lib/v1/layout/SubtabLayout/SubtabLayout.js +245 -0
- package/lib/v1/layout/SubtabLayout/index.js +37 -0
- package/lib/v1/list/AvatarFlip/AvatarFlip.js +131 -0
- package/lib/v1/list/BluePrintStatus/BluePrintStatus.js +73 -0
- package/lib/v1/list/Comment/Comment.js +98 -0
- package/lib/v1/list/DepartmentDropDown/DepartmentDropDown.js +157 -0
- package/lib/v1/list/Dot/Dot.js +72 -0
- package/lib/v1/list/DotNew/DotNew.js +79 -0
- package/lib/v1/list/GridStencils/GridStencils.js +83 -0
- package/lib/v1/list/Icons/AddNewIcon.js +79 -0
- package/lib/v1/list/Icons/CompleteIcon.js +81 -0
- package/lib/v1/list/Icons/DeleteIcon.js +82 -0
- package/lib/v1/list/Icons/EditIcon.js +82 -0
- package/lib/v1/list/Icons/FloatingIcons.js +87 -0
- package/lib/v1/list/Icons/ReadUnreadIcon.js +87 -0
- package/lib/v1/list/Icons/SmartIcon.js +83 -0
- package/lib/v1/list/Icons/index.js +63 -0
- package/lib/v1/list/ListLayout/ListLayout.js +145 -0
- package/lib/v1/list/ListStencils/ListStencils.js +96 -0
- package/lib/v1/list/SecondaryText/AccountName.js +136 -0
- package/lib/v1/list/SecondaryText/ContactName.js +144 -0
- package/lib/v1/list/SecondaryText/DepartmentText.js +79 -0
- package/lib/v1/list/SecondaryText/Email.js +103 -0
- package/lib/v1/list/SecondaryText/HappinessRating.js +81 -0
- package/lib/v1/list/SecondaryText/PhoneNumber.js +107 -0
- package/lib/v1/list/SecondaryText/PriorityText.js +83 -0
- package/lib/v1/list/SecondaryText/SecondaryText.js +88 -0
- package/lib/v1/list/SecondaryText/StatusText.js +84 -0
- package/lib/v1/list/SecondaryText/TicketId.js +104 -0
- package/lib/v1/list/SecondaryText/Website.js +91 -0
- package/lib/v1/list/SecondaryText/index.js +95 -0
- package/lib/v1/list/SecondryPanel/SecondryPanel.js +205 -0
- package/lib/v1/list/SentimentStatus/SentimentStatus.js +80 -0
- package/lib/v1/list/Subject/Subject.js +108 -0
- package/lib/v1/list/TagNew/TagNew.js +83 -0
- package/lib/v1/list/Thread/Thread.js +95 -0
- package/lib/v1/list/UserTime/UserTime.js +136 -0
- package/lib/v1/list/index.js +173 -0
- package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +541 -0
- package/lib/v1/list/status/StatusListItem/StatusListItem.js +168 -0
- package/lib/v1/list/status/index.js +23 -0
- package/lib/v1/lookup/EmptyPage/EmptyPage.js +120 -0
- package/lib/v1/lookup/Lookup/Lookup.js +2 -0
- package/lib/v1/lookup/Section/Section.js +75 -0
- package/lib/v1/lookup/header/ViewDropDown/ViewDropDown.js +221 -0
- package/lib/v1/lookup/header/index.js +47 -0
- package/lib/v1/setup/header/Button/Button.js +83 -0
- package/lib/v1/setup/header/Link/Link.js +93 -0
- package/lib/v1/setup/header/Search/Search.js +126 -0
- package/lib/v1/setup/header/Views/Views.js +93 -0
- package/lib/v1/setup/header/index.js +39 -0
- package/lib/v1/setup/helptips/Description/Description.js +68 -0
- package/lib/v1/setup/helptips/Link/Link.js +88 -0
- package/lib/v1/setup/helptips/ListGroup/ListGroup.js +88 -0
- package/lib/v1/setup/helptips/Title/Title.js +68 -0
- package/lib/v1/setup/helptips/index.js +39 -0
- package/lib/v1/setup/index.js +24 -0
- package/lib/v1/setup/table/index.js +47 -0
- package/lib/v1/svg/PlusIcon.js +82 -0
- package/lib/v1/svg/SnippetIcon.js +84 -0
- package/lib/v1/svg/TemplateIcon.js +85 -0
- package/lib/v1/svg/index.js +31 -0
- package/lib/v1/version2/alertIcons/index.js +71 -0
- package/lib/v1/version2/index.js +58 -0
- package/lib/v1/version2/lookup/AlertHeader/AlertHeader.js +104 -0
- package/lib/v1/version2/lookup/AlertLookup/AlertLookup.js +17 -5
- package/lib/v1/version2/notification/DesktopNotification/DesktopNotification.js +193 -0
- package/lib/version2/lookup/AlertLookup/AlertLookup.js +14 -2
- package/package.json +9 -9
- package/result.json +1 -1
- package/es/docs/formDocs.js +0 -15
- package/es/docs/generalDocs.js +0 -63
- package/es/docs/lookupDocs.js +0 -17
- package/es/docs/setupDocs.js +0 -11
- package/lib/docs/generalDocs.js +0 -479
- package/lib/docs/lookupDocs.js +0 -135
- package/lib/docs/setupDocs.js +0 -95
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React, { Component, Fragment } from 'react';
|
|
4
|
+
import { defaultProps } from '../../../dropdown/ToggleDropDown/props/defaultProps';
|
|
5
|
+
import { propTypes } from '../../../dropdown/ToggleDropDown/props/propTypes';
|
|
6
|
+
import { Icon } from '@zohodesk/icons';
|
|
7
|
+
import Popup from '@zohodesk/components/lib/Popup/Popup';
|
|
8
|
+
import { Box, Container } from '@zohodesk/components/lib/Layout';
|
|
9
|
+
import ListItem from '@zohodesk/components/lib/ListItem/ListItem';
|
|
10
|
+
import ListItemWithIcon from '@zohodesk/components/lib/ListItem/ListItemWithIcon';
|
|
11
|
+
import DropDownHeading from '@zohodesk/components/lib/DropDown/DropDownHeading';
|
|
12
|
+
import TextBoxIcon from '@zohodesk/components/lib/TextBoxIcon/TextBoxIcon';
|
|
13
|
+
import Loader from '@zohodesk/svg/lib/Loader/Loader';
|
|
14
|
+
import CommonEmptyState from '../../emptystate/CommonEmptyState/CommonEmptyState';
|
|
15
|
+
import EmptySearch from '@zohodesk/svg/lib/emptystate/version3/EmptySearch';
|
|
16
|
+
import CssProvider from '@zohodesk/components/lib/Provider/CssProvider';
|
|
17
|
+
import { scrollTo, findScrollEnd } from '@zohodesk/components/lib/utils/Common';
|
|
18
|
+
import { getUniqueId } from '@zohodesk/components/lib/Provider/IdProvider';
|
|
19
|
+
import btnStyle from '@zohodesk/components/lib/semantic/Button/semanticButton.module.css';
|
|
20
|
+
import RippleEffect from '@zohodesk/components/lib/RippleEffect/RippleEffect';
|
|
21
|
+
import ResponsiveDropBox from '@zohodesk/components/lib/ResponsiveDropBox/ResponsiveDropBox';
|
|
22
|
+
import { ResponsiveReceiver } from '@zohodesk/components/lib/Responsive/CustomResponsive';
|
|
23
|
+
import style from '../../../dropdown/ToggleDropDown/ToggleDropDown.module.css';
|
|
24
|
+
export class ToggleDropDown extends Component {
|
|
25
|
+
constructor(props) {
|
|
26
|
+
super(props);
|
|
27
|
+
this.state = {
|
|
28
|
+
searchValue: '',
|
|
29
|
+
// selectedIndex: -1,
|
|
30
|
+
options: props.options,
|
|
31
|
+
isFetchingOptions: false
|
|
32
|
+
};
|
|
33
|
+
this._isMounted = false;
|
|
34
|
+
this.handleChange = this.handleChange.bind(this); // this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
35
|
+
|
|
36
|
+
this.onSelect = this.onSelect.bind(this);
|
|
37
|
+
this.handleTogglePopup = this.handleTogglePopup.bind(this);
|
|
38
|
+
this.showTogglePopup = this.showTogglePopup.bind(this);
|
|
39
|
+
this.hideTogglePopup = this.hideTogglePopup.bind(this);
|
|
40
|
+
this.onSearchAPI = this.onSearchAPI.bind(this);
|
|
41
|
+
this.onSearchClear = this.onSearchClear.bind(this);
|
|
42
|
+
this.handleFilterSuggestions = this.handleFilterSuggestions.bind(this);
|
|
43
|
+
this.scrollContentRef = this.scrollContentRef.bind(this); // this.handleMouseEnter = this.handleMouseEnter.bind(this);
|
|
44
|
+
|
|
45
|
+
this.searchInputRef = this.searchInputRef.bind(this);
|
|
46
|
+
this.itemRef = this.itemRef.bind(this); // this.inputRef = this.inputRef.bind(this);
|
|
47
|
+
|
|
48
|
+
this.handleScroll = this.handleScroll.bind(this); // this.getOptionsArray = this.getOptionsArray.bind(this);
|
|
49
|
+
|
|
50
|
+
this.emptySearchSVG = this.emptySearchSVG.bind(this);
|
|
51
|
+
this.getAriaId = getUniqueId(this); // this.getSelectedIndex = this.getSelectedIndex.bind(this);
|
|
52
|
+
|
|
53
|
+
this.handleGetNextOptions = this.handleGetNextOptions.bind(this);
|
|
54
|
+
this.handleFetchOptions = this.handleFetchOptions.bind(this);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
componentDidMount() {
|
|
58
|
+
this._isMounted = true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
componentWillUnmount() {
|
|
62
|
+
this._isMounted = false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
emptySearchSVG() {
|
|
66
|
+
return /*#__PURE__*/React.createElement(EmptySearch, {
|
|
67
|
+
size: "small"
|
|
68
|
+
});
|
|
69
|
+
} // inputRef(el) {
|
|
70
|
+
// this.hiddenInput = el;
|
|
71
|
+
// }
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
itemRef(ele, index, id) {
|
|
75
|
+
this[`suggestion_${id}`] = ele;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
searchInputRef(el) {
|
|
79
|
+
this.searchInput = el;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
handleTogglePopup(e) {
|
|
83
|
+
const {
|
|
84
|
+
togglePopup,
|
|
85
|
+
boxPosition,
|
|
86
|
+
onSelectLabel,
|
|
87
|
+
isPopupOpen,
|
|
88
|
+
removeClose
|
|
89
|
+
} = this.props;
|
|
90
|
+
removeClose && removeClose(e);
|
|
91
|
+
!isPopupOpen && onSelectLabel && onSelectLabel(e);
|
|
92
|
+
togglePopup(e, boxPosition);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
showTogglePopup(e) {
|
|
96
|
+
const {
|
|
97
|
+
togglePopup,
|
|
98
|
+
boxPosition,
|
|
99
|
+
onSelectLabel,
|
|
100
|
+
isPopupOpen
|
|
101
|
+
} = this.props;
|
|
102
|
+
!isPopupOpen && onSelectLabel && onSelectLabel(e);
|
|
103
|
+
!isPopupOpen && togglePopup(e, boxPosition);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
hideTogglePopup(e) {
|
|
107
|
+
const {
|
|
108
|
+
togglePopup,
|
|
109
|
+
boxPosition,
|
|
110
|
+
onSelectLabel,
|
|
111
|
+
isPopupOpen
|
|
112
|
+
} = this.props;
|
|
113
|
+
!isPopupOpen && onSelectLabel && onSelectLabel(e);
|
|
114
|
+
isPopupOpen && togglePopup(e, boxPosition);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
scrollContentRef(el) {
|
|
118
|
+
const {
|
|
119
|
+
isPopupOpen
|
|
120
|
+
} = this.props;
|
|
121
|
+
|
|
122
|
+
if (isPopupOpen) {
|
|
123
|
+
this.optionsContainer = el;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
128
|
+
this.setState({
|
|
129
|
+
options: nextProps.options
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
onSelect(element, e) {
|
|
134
|
+
const {
|
|
135
|
+
onClick,
|
|
136
|
+
togglePopup,
|
|
137
|
+
preventPopupClose
|
|
138
|
+
} = this.props;
|
|
139
|
+
onClick && onClick(e, element);
|
|
140
|
+
!preventPopupClose && togglePopup(e);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
componentDidUpdate(prevProps) {
|
|
144
|
+
const {
|
|
145
|
+
isPopupOpen,
|
|
146
|
+
isPopupReady,
|
|
147
|
+
isSearch,
|
|
148
|
+
idName,
|
|
149
|
+
options,
|
|
150
|
+
onDropDownOpen,
|
|
151
|
+
onDropDownClose
|
|
152
|
+
} = this.props;
|
|
153
|
+
const {
|
|
154
|
+
selectedIndex,
|
|
155
|
+
searchValue
|
|
156
|
+
} = this.state; // eslint-disable-next-line
|
|
157
|
+
|
|
158
|
+
if (prevProps.isPopupReady !== isPopupReady) {// setTimeout(() => {
|
|
159
|
+
// isPopupReady
|
|
160
|
+
// ? isSearch
|
|
161
|
+
// ? this.searchInput.focus({ preventScroll: true })
|
|
162
|
+
// : this.hiddenInput.focus({ preventScroll: true })
|
|
163
|
+
// : this.hiddenInput.focus({ preventScroll: true });
|
|
164
|
+
// }, 10);
|
|
165
|
+
} // const optionsArr = this.getOptionsArray();
|
|
166
|
+
// const option = optionsArr[selectedIndex];
|
|
167
|
+
// const id = (option && option[idName]) || {};
|
|
168
|
+
// const selSuggestion = this[`suggestion_${id}`];
|
|
169
|
+
// if (isPopupOpen) {
|
|
170
|
+
// this.optionsContainer && scrollTo(this.optionsContainer, selSuggestion);
|
|
171
|
+
// }
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
if (!prevProps.isPopupOpen && isPopupOpen && searchValue.length) {
|
|
175
|
+
this.onSearchClear();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (this.props.from == 'activityFilter') {
|
|
179
|
+
//Temproary
|
|
180
|
+
const results = this.props.options.filter(_ref => {
|
|
181
|
+
let {
|
|
182
|
+
isDisabled: id1
|
|
183
|
+
} = _ref;
|
|
184
|
+
return !prevProps.options.some(_ref2 => {
|
|
185
|
+
let {
|
|
186
|
+
isDisabled: id2
|
|
187
|
+
} = _ref2;
|
|
188
|
+
return id2 === id1;
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
if (results.length > 0) {
|
|
193
|
+
this.setState({
|
|
194
|
+
options: options
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (prevProps.isPopupOpen !== isPopupOpen) {
|
|
200
|
+
if (isPopupOpen) {
|
|
201
|
+
onDropDownOpen && onDropDownOpen();
|
|
202
|
+
} else {
|
|
203
|
+
onDropDownClose && onDropDownClose();
|
|
204
|
+
} // this.getSelectedIndex(optionsArr);
|
|
205
|
+
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
handleFilterSuggestions(searchValue) {
|
|
210
|
+
const {
|
|
211
|
+
options,
|
|
212
|
+
keyName,
|
|
213
|
+
isGroupDropDown,
|
|
214
|
+
groupOptionsKey,
|
|
215
|
+
groupNameKey
|
|
216
|
+
} = this.props;
|
|
217
|
+
searchValue = searchValue.trim().toLowerCase();
|
|
218
|
+
let result = [];
|
|
219
|
+
|
|
220
|
+
if (isGroupDropDown) {
|
|
221
|
+
const filteredGroups = [];
|
|
222
|
+
options.map(group => {
|
|
223
|
+
const {
|
|
224
|
+
needDivider
|
|
225
|
+
} = group;
|
|
226
|
+
const name = group[groupNameKey];
|
|
227
|
+
const groupOptions = group[groupOptionsKey];
|
|
228
|
+
const datas = groupOptions.filter(list => {
|
|
229
|
+
const value = list[keyName];
|
|
230
|
+
return value.toLowerCase().includes(searchValue);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
if (datas.length) {
|
|
234
|
+
filteredGroups.push({
|
|
235
|
+
[groupNameKey]: name,
|
|
236
|
+
[groupOptionsKey]: datas,
|
|
237
|
+
needDivider
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
result = filteredGroups;
|
|
242
|
+
} else {
|
|
243
|
+
let filteredOptions = options.filter((item, i) => {
|
|
244
|
+
if (item.needDivider) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return item[keyName].toLowerCase().includes(searchValue);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
if (filteredOptions.length) {
|
|
252
|
+
// to avoid more than one dividers consecutively comes as one by one
|
|
253
|
+
let needDividerCount = 0;
|
|
254
|
+
const orderedOptions = filteredOptions.filter(item => {
|
|
255
|
+
if (item.needDivider && needDividerCount === 0) {
|
|
256
|
+
needDividerCount++;
|
|
257
|
+
return true;
|
|
258
|
+
} else if (!item.needDivider) {
|
|
259
|
+
needDividerCount = 0;
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
}); // remove divider if it placed in first or last index
|
|
263
|
+
|
|
264
|
+
filteredOptions = [];
|
|
265
|
+
filteredOptions = orderedOptions.filter((item, i) => {
|
|
266
|
+
if (i == 0 || i == orderedOptions.length - 1) {
|
|
267
|
+
if (!item.needDivider) {
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
} else {
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
result = filteredOptions;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return result;
|
|
279
|
+
} // getOptionsArray() {
|
|
280
|
+
// const { searchValue } = this.state;
|
|
281
|
+
// const { isGroupDropDown, groupOptionsKey } = this.props;
|
|
282
|
+
// const options = searchValue.length ? this.handleFilterSuggestions(searchValue) : this.props.options;
|
|
283
|
+
// let optionsArr = [];
|
|
284
|
+
// if (isGroupDropDown) {
|
|
285
|
+
// for (let i = 0; i < options.length; i++) {
|
|
286
|
+
// const groupOptions = options[i][groupOptionsKey];
|
|
287
|
+
// Array.prototype.push.apply(optionsArr, groupOptions);
|
|
288
|
+
// }
|
|
289
|
+
// } else {
|
|
290
|
+
// optionsArr = options.filter((item) => !item.needDivider);
|
|
291
|
+
// }
|
|
292
|
+
// return optionsArr;
|
|
293
|
+
// }
|
|
294
|
+
// handleKeyDown(e) {
|
|
295
|
+
// const { keyCode } = e;
|
|
296
|
+
// const { selectedIndex, searchValue } = this.state;
|
|
297
|
+
// const optionsArr = this.getOptionsArray();
|
|
298
|
+
// const totalIndex = optionsArr.length;
|
|
299
|
+
// const { togglePopup, onClick, boxPosition, isPopupReady, value, keyName, idName, preventPopupClose, isSearch } =
|
|
300
|
+
// this.props;
|
|
301
|
+
// if (isPopupReady && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
|
|
302
|
+
// e.preventDefault(); //prevent body scroll
|
|
303
|
+
// }
|
|
304
|
+
// if (isPopupReady) {
|
|
305
|
+
// switch (keyCode) {
|
|
306
|
+
// case 40:
|
|
307
|
+
// if (selectedIndex === totalIndex - 1) {
|
|
308
|
+
// this.setState({ selectedIndex: 0 });
|
|
309
|
+
// } else {
|
|
310
|
+
// if (selectedIndex === totalIndex - 3) {
|
|
311
|
+
// this.handleGetNextOptions();
|
|
312
|
+
// }
|
|
313
|
+
// this.setState({
|
|
314
|
+
// selectedIndex: selectedIndex + 1
|
|
315
|
+
// });
|
|
316
|
+
// }
|
|
317
|
+
// break;
|
|
318
|
+
// case 38:
|
|
319
|
+
// if (selectedIndex === 0) {
|
|
320
|
+
// this.setState({ selectedIndex: totalIndex - 1 });
|
|
321
|
+
// } else {
|
|
322
|
+
// this.setState({
|
|
323
|
+
// selectedIndex: selectedIndex - 1
|
|
324
|
+
// });
|
|
325
|
+
// }
|
|
326
|
+
// break;
|
|
327
|
+
// case 13: {
|
|
328
|
+
// const selectedId = optionsArr[selectedIndex][idName] || '';
|
|
329
|
+
// onClick && onClick(selectedId, optionsArr[selectedIndex]);
|
|
330
|
+
// if (!preventPopupClose) {
|
|
331
|
+
// togglePopup(e, boxPosition);
|
|
332
|
+
// } else if (isSearch) {
|
|
333
|
+
// this.searchInput.focus({ preventScroll: true });
|
|
334
|
+
// } else {
|
|
335
|
+
// this.hiddenInput.focus({ preventScroll: true });
|
|
336
|
+
// }
|
|
337
|
+
// break;
|
|
338
|
+
// }
|
|
339
|
+
// }
|
|
340
|
+
// } else {
|
|
341
|
+
// if (keyCode === 13 || keyCode === 40) {
|
|
342
|
+
// togglePopup(e, boxPosition);
|
|
343
|
+
// }
|
|
344
|
+
// }
|
|
345
|
+
// }
|
|
346
|
+
// getSelectedIndex(optionsArr) {
|
|
347
|
+
// const { selectedId, idName } = this.props;
|
|
348
|
+
// if (selectedId) {
|
|
349
|
+
// for (let i = 0; i < optionsArr.length; i++) {
|
|
350
|
+
// const indexId = optionsArr[i][idName];
|
|
351
|
+
// if (selectedId === indexId) {
|
|
352
|
+
// this.setState({
|
|
353
|
+
// selectedIndex: i
|
|
354
|
+
// });
|
|
355
|
+
// break;
|
|
356
|
+
// }
|
|
357
|
+
// }
|
|
358
|
+
// } else {
|
|
359
|
+
// this.setState({
|
|
360
|
+
// selectedIndex: -1
|
|
361
|
+
// });
|
|
362
|
+
// }
|
|
363
|
+
// }
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
onSearchAPI() {
|
|
367
|
+
const {
|
|
368
|
+
searchValue
|
|
369
|
+
} = this.state;
|
|
370
|
+
const {
|
|
371
|
+
needSearchFetching,
|
|
372
|
+
onSearch
|
|
373
|
+
} = this.props;
|
|
374
|
+
|
|
375
|
+
if (needSearchFetching && onSearch) {
|
|
376
|
+
onSearch(searchValue);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
handleChange(value, e) {
|
|
381
|
+
const filteredOptions = this.handleFilterSuggestions(value);
|
|
382
|
+
this.setState({
|
|
383
|
+
searchValue: value,
|
|
384
|
+
// selectedIndex: -1,
|
|
385
|
+
options: filteredOptions
|
|
386
|
+
}, () => {
|
|
387
|
+
this.onSearchAPI();
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
onSearchClear() {
|
|
392
|
+
const filteredOptions = this.handleFilterSuggestions('');
|
|
393
|
+
this.setState({
|
|
394
|
+
searchValue: '',
|
|
395
|
+
options: filteredOptions
|
|
396
|
+
}, () => {
|
|
397
|
+
this.onSearchAPI();
|
|
398
|
+
});
|
|
399
|
+
} // handleMouseEnter(id, value, index, e) {
|
|
400
|
+
// this.setState({
|
|
401
|
+
// selectedIndex: index
|
|
402
|
+
// });
|
|
403
|
+
// }
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
handleScroll(e) {
|
|
407
|
+
let ele = e.target;
|
|
408
|
+
let isScrollReachedBottom = findScrollEnd(ele);
|
|
409
|
+
isScrollReachedBottom && this.handleGetNextOptions();
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
handleGetNextOptions() {
|
|
413
|
+
let {
|
|
414
|
+
isNextOptions,
|
|
415
|
+
getNextOptions
|
|
416
|
+
} = this.props;
|
|
417
|
+
let {
|
|
418
|
+
searchValue
|
|
419
|
+
} = this.state;
|
|
420
|
+
isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchValue);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
handleFetchOptions(APICall) {
|
|
424
|
+
let searchValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
425
|
+
let {
|
|
426
|
+
isFetchingOptions = false
|
|
427
|
+
} = this.state;
|
|
428
|
+
let {
|
|
429
|
+
_isMounted
|
|
430
|
+
} = this;
|
|
431
|
+
|
|
432
|
+
if (!isFetchingOptions && APICall) {
|
|
433
|
+
this.setState({
|
|
434
|
+
isFetchingOptions: true
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
try {
|
|
438
|
+
return APICall(searchValue).then(() => {
|
|
439
|
+
_isMounted && this.setState({
|
|
440
|
+
isFetchingOptions: false
|
|
441
|
+
});
|
|
442
|
+
}, () => {
|
|
443
|
+
_isMounted && this.setState({
|
|
444
|
+
isFetchingOptions: false
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
} catch (e) {
|
|
448
|
+
_isMounted && this.setState({
|
|
449
|
+
isFetchingOptions: false
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
responsiveFunc(_ref3) {
|
|
456
|
+
let {
|
|
457
|
+
mediaQueryOR
|
|
458
|
+
} = _ref3;
|
|
459
|
+
return {
|
|
460
|
+
tabletMode: mediaQueryOR([{
|
|
461
|
+
maxWidth: 700
|
|
462
|
+
}])
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
render() {
|
|
467
|
+
const {
|
|
468
|
+
options,
|
|
469
|
+
selectedIndex
|
|
470
|
+
} = this.state;
|
|
471
|
+
const {
|
|
472
|
+
value,
|
|
473
|
+
removeClose,
|
|
474
|
+
boxSize,
|
|
475
|
+
keyName,
|
|
476
|
+
idName,
|
|
477
|
+
title,
|
|
478
|
+
isSearch,
|
|
479
|
+
isArrow,
|
|
480
|
+
placeHolderText,
|
|
481
|
+
className,
|
|
482
|
+
right,
|
|
483
|
+
left,
|
|
484
|
+
top,
|
|
485
|
+
bottom,
|
|
486
|
+
isPopupOpen: isOpen,
|
|
487
|
+
isPopupActive,
|
|
488
|
+
needExternalPopupState,
|
|
489
|
+
isPopupReady,
|
|
490
|
+
position,
|
|
491
|
+
getTargetRef,
|
|
492
|
+
getContainerRef,
|
|
493
|
+
dataId,
|
|
494
|
+
dataSelectorId,
|
|
495
|
+
searchBoxSize,
|
|
496
|
+
searchEmptyHint,
|
|
497
|
+
searchErrorText,
|
|
498
|
+
activeStyle,
|
|
499
|
+
showOnHover,
|
|
500
|
+
isDisabled,
|
|
501
|
+
showIconOnHover,
|
|
502
|
+
isReadOnly,
|
|
503
|
+
hoverStyle,
|
|
504
|
+
isEditable,
|
|
505
|
+
iconName,
|
|
506
|
+
iconSize,
|
|
507
|
+
needTick,
|
|
508
|
+
dataTitle,
|
|
509
|
+
isDataLoaded,
|
|
510
|
+
children,
|
|
511
|
+
needResponsive,
|
|
512
|
+
arrowIconPosition,
|
|
513
|
+
isGroupDropDown,
|
|
514
|
+
groupOptionsKey,
|
|
515
|
+
groupNameKey,
|
|
516
|
+
isToggleStateNeeded,
|
|
517
|
+
selectedId,
|
|
518
|
+
isPadding,
|
|
519
|
+
isNeedEffect,
|
|
520
|
+
hoverType,
|
|
521
|
+
palette,
|
|
522
|
+
getFooter,
|
|
523
|
+
customProps,
|
|
524
|
+
needMultiLineText,
|
|
525
|
+
customClass
|
|
526
|
+
} = this.props;
|
|
527
|
+
let {
|
|
528
|
+
ToggleDropDownProps = {},
|
|
529
|
+
DropBoxProps = {},
|
|
530
|
+
TextBoxIconProps = {},
|
|
531
|
+
ListItemWithIconProps = {},
|
|
532
|
+
ListItemProps = {}
|
|
533
|
+
} = customProps;
|
|
534
|
+
let {
|
|
535
|
+
customDropBox = '',
|
|
536
|
+
customListBox = ''
|
|
537
|
+
} = customClass;
|
|
538
|
+
const isPopupOpen = needExternalPopupState ? isPopupActive && isOpen : isOpen;
|
|
539
|
+
const Component = isToggleStateNeeded ? children.type : null,
|
|
540
|
+
componentProps = isToggleStateNeeded ? children.props : null;
|
|
541
|
+
const {
|
|
542
|
+
searchValue,
|
|
543
|
+
isFetchingOptions
|
|
544
|
+
} = this.state;
|
|
545
|
+
const commonClass = `${className ? className : ''} ${isPopupReady ? activeStyle ? activeStyle : '' : ''} ${isDisabled ? CssProvider('isDisable') : isReadOnly || !isEditable ? style.cursorDefault : !showOnHover ? `${style.cursor} ${hoverStyle ? hoverStyle : ''}` : `${hoverStyle ? hoverStyle : ''} ${style.cursorDefault}`}`;
|
|
546
|
+
let listIndex = -1;
|
|
547
|
+
const ariaTitleId = this.getAriaId(); // const allyOptionsArr = this.getOptionsArray();
|
|
548
|
+
|
|
549
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
550
|
+
className: style.wrapper,
|
|
551
|
+
onMouseEnter: showOnHover && !isDisabled && !isReadOnly && isEditable ? this.showTogglePopup : undefined,
|
|
552
|
+
onMouseLeave: showOnHover && !isDisabled && !isReadOnly && isEditable ? this.hideTogglePopup : undefined,
|
|
553
|
+
"data-selector-id": dataSelectorId
|
|
554
|
+
}, ToggleDropDownProps), /*#__PURE__*/React.createElement(Container, {
|
|
555
|
+
alignBox: "row",
|
|
556
|
+
onClick: !showOnHover && !isDisabled && !isReadOnly && isEditable && this.handleTogglePopup,
|
|
557
|
+
eleRef: getTargetRef,
|
|
558
|
+
align: "vertical",
|
|
559
|
+
isCover: false,
|
|
560
|
+
dataId: dataId
|
|
561
|
+
}, children ? isToggleStateNeeded ? /*#__PURE__*/React.createElement(Component, _extends({}, componentProps, {
|
|
562
|
+
isActive: isPopupOpen
|
|
563
|
+
})) : children : /*#__PURE__*/React.createElement(RippleEffect, {
|
|
564
|
+
hoverType: hoverType,
|
|
565
|
+
isActive: isPopupOpen,
|
|
566
|
+
isNeedEffect: isEditable && isNeedEffect
|
|
567
|
+
}, /*#__PURE__*/React.createElement(Container, {
|
|
568
|
+
className: `${btnStyle.buttonReset} ${commonClass} ${!isPopupOpen && showIconOnHover ? style.hoverIcon : ''}`,
|
|
569
|
+
isCover: false,
|
|
570
|
+
alignBox: "row",
|
|
571
|
+
align: "vertical",
|
|
572
|
+
tagName: "button",
|
|
573
|
+
"aria-labelledby": ariaTitleId,
|
|
574
|
+
"aria-haspopup": true,
|
|
575
|
+
"aria-expanded": isPopupOpen ? true : false
|
|
576
|
+
}, iconName ? /*#__PURE__*/React.createElement(Box, {
|
|
577
|
+
className: value ? style.iconBox : ''
|
|
578
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
579
|
+
name: iconName,
|
|
580
|
+
size: iconSize
|
|
581
|
+
})) : null, value && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
|
|
582
|
+
id: ariaTitleId,
|
|
583
|
+
"aria-hidden": true,
|
|
584
|
+
className: `${style.value} toggleDropText`,
|
|
585
|
+
shrink: true,
|
|
586
|
+
tagName: "span",
|
|
587
|
+
"data-title": dataTitle
|
|
588
|
+
}, value), isEditable ? /*#__PURE__*/React.createElement(Icon, {
|
|
589
|
+
"aria-hidden": true,
|
|
590
|
+
size: "6",
|
|
591
|
+
name: "ZD-down",
|
|
592
|
+
iconClass: `${'toggleDropIcon'} ${style.arrow} ${style[`${arrowIconPosition}_arrow`]}`,
|
|
593
|
+
dataId: "statusdownarrow"
|
|
594
|
+
}) : null)))), isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
595
|
+
query: this.responsiveFunc,
|
|
596
|
+
responsiveId: "Helmet"
|
|
597
|
+
}, _ref4 => {
|
|
598
|
+
let {
|
|
599
|
+
tabletMode
|
|
600
|
+
} = _ref4;
|
|
601
|
+
return /*#__PURE__*/React.createElement(ResponsiveDropBox, _extends({
|
|
602
|
+
boxPosition: position,
|
|
603
|
+
isActive: isPopupReady,
|
|
604
|
+
onClick: removeClose,
|
|
605
|
+
size: boxSize,
|
|
606
|
+
right: right,
|
|
607
|
+
left: left,
|
|
608
|
+
top: top,
|
|
609
|
+
bottom: bottom,
|
|
610
|
+
isArrow: isArrow,
|
|
611
|
+
isAnimate: true,
|
|
612
|
+
getRef: getContainerRef,
|
|
613
|
+
customClass: {
|
|
614
|
+
customDropBoxWrap: style.dropBoxContainer,
|
|
615
|
+
customDropBox: customDropBox
|
|
616
|
+
},
|
|
617
|
+
needResponsive: needResponsive,
|
|
618
|
+
isPadding: isPadding,
|
|
619
|
+
tabindex: "0",
|
|
620
|
+
a11y: {
|
|
621
|
+
role: !isSearch ? 'menu' : undefined,
|
|
622
|
+
ariaLabelledby: !isSearch ? ariaTitleId : undefined
|
|
623
|
+
},
|
|
624
|
+
palette: palette,
|
|
625
|
+
isResponsivePadding: true,
|
|
626
|
+
needFocusScope: true,
|
|
627
|
+
customProps: {
|
|
628
|
+
focusScopeProps: {
|
|
629
|
+
loadNextOptions: this.handleGetNextOptions,
|
|
630
|
+
searchValue: searchValue,
|
|
631
|
+
isFetchingOptions: isFetchingOptions
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}, DropBoxProps, {
|
|
635
|
+
onClose: this.handleTogglePopup
|
|
636
|
+
}), /*#__PURE__*/React.createElement(React.Fragment, null, isSearch ? /*#__PURE__*/React.createElement(Box, {
|
|
637
|
+
className: style.search
|
|
638
|
+
}, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
|
|
639
|
+
placeHolder: placeHolderText,
|
|
640
|
+
onChange: this.handleChange,
|
|
641
|
+
value: searchValue,
|
|
642
|
+
onClear: this.onSearchClear,
|
|
643
|
+
size: searchBoxSize // inputRef={this.searchInputRef}
|
|
644
|
+
,
|
|
645
|
+
customProps: {
|
|
646
|
+
TextBoxProps: {
|
|
647
|
+
'data-a11y-autofocus': true
|
|
648
|
+
}
|
|
649
|
+
} //search
|
|
650
|
+
// onKeyDown={this.handleKeyDown}
|
|
651
|
+
,
|
|
652
|
+
a11y: {
|
|
653
|
+
role: 'combobox',
|
|
654
|
+
ariaOwns: ariaTitleId,
|
|
655
|
+
// ariaActivedescendant: allyOptionsArr[selectedIndex] && allyOptionsArr[selectedIndex][keyName],
|
|
656
|
+
ariaAutocomplete: 'list',
|
|
657
|
+
ariaHaspopup: true,
|
|
658
|
+
ariaExpanded: true
|
|
659
|
+
}
|
|
660
|
+
}, TextBoxIconProps))) : null, title && options.length != 0 && /*#__PURE__*/React.createElement(Box, {
|
|
661
|
+
className: style.title
|
|
662
|
+
}, /*#__PURE__*/React.createElement(DropDownHeading, {
|
|
663
|
+
text: title,
|
|
664
|
+
htmlId: ariaTitleId,
|
|
665
|
+
palette: palette,
|
|
666
|
+
a11y: {
|
|
667
|
+
role: 'heading'
|
|
668
|
+
},
|
|
669
|
+
customClass: style.dropdown
|
|
670
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
671
|
+
id: ariaTitleId,
|
|
672
|
+
flexible: true,
|
|
673
|
+
shrink: true,
|
|
674
|
+
scroll: "vertical",
|
|
675
|
+
preventParentScroll: "vertical",
|
|
676
|
+
dataId: `${dataId}_list`,
|
|
677
|
+
className: `${tabletMode ? style.responsivemaxHgt : style.maxHgt} ${customListBox}`,
|
|
678
|
+
eleRef: this.scrollContentRef,
|
|
679
|
+
onScroll: this.handleScroll,
|
|
680
|
+
role: isSearch ? 'listbox' : 'menu',
|
|
681
|
+
"aria-labelledby": isSearch ? ariaTitleId : undefined,
|
|
682
|
+
"data-scroll": "true"
|
|
683
|
+
}, isDataLoaded ? options && options.length != 0 ? isGroupDropDown ? /*#__PURE__*/React.createElement(React.Fragment, null, options.map(group => {
|
|
684
|
+
const groupName = group[groupNameKey];
|
|
685
|
+
const groupOptions = group[groupOptionsKey];
|
|
686
|
+
const {
|
|
687
|
+
needDivider
|
|
688
|
+
} = group;
|
|
689
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
690
|
+
key: `index${groupName}`
|
|
691
|
+
}, needDivider && /*#__PURE__*/React.createElement("div", {
|
|
692
|
+
className: style.seperatedLine
|
|
693
|
+
}), groupName && /*#__PURE__*/React.createElement("div", {
|
|
694
|
+
className: style.groupName
|
|
695
|
+
}, /*#__PURE__*/React.createElement(DropDownHeading, {
|
|
696
|
+
text: groupName,
|
|
697
|
+
palette: palette,
|
|
698
|
+
a11y: {
|
|
699
|
+
role: 'heading'
|
|
700
|
+
}
|
|
701
|
+
})), groupOptions && groupOptions.map(item => {
|
|
702
|
+
const {
|
|
703
|
+
iconName,
|
|
704
|
+
iconSize,
|
|
705
|
+
iconClass,
|
|
706
|
+
title,
|
|
707
|
+
disableTitle = '',
|
|
708
|
+
isDisabled = false
|
|
709
|
+
} = item;
|
|
710
|
+
listIndex += 1;
|
|
711
|
+
return iconName ? /*#__PURE__*/React.createElement(ListItemWithIcon, _extends({
|
|
712
|
+
key: listIndex,
|
|
713
|
+
dataId: item[keyName],
|
|
714
|
+
value: item[keyName],
|
|
715
|
+
id: item[idName],
|
|
716
|
+
active: selectedId === item[idName],
|
|
717
|
+
onClick: this.onSelect.bind(this, item),
|
|
718
|
+
index: listIndex // highlight={selectedIndex === listIndex}
|
|
719
|
+
,
|
|
720
|
+
disableTitle: disableTitle,
|
|
721
|
+
isDisabled: isDisabled,
|
|
722
|
+
iconName: iconName,
|
|
723
|
+
iconClass: iconClass,
|
|
724
|
+
iconSize: iconSize,
|
|
725
|
+
needTick: needTick,
|
|
726
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
727
|
+
,
|
|
728
|
+
getRef: this.itemRef,
|
|
729
|
+
title: title ? title : item[keyName],
|
|
730
|
+
palette: palette,
|
|
731
|
+
needMultiLineText: needMultiLineText,
|
|
732
|
+
autoHover: true,
|
|
733
|
+
a11y: {
|
|
734
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
735
|
+
ariaSelected: selectedId === item[idName],
|
|
736
|
+
ariaLabel: item[keyName]
|
|
737
|
+
}
|
|
738
|
+
}, ListItemWithIconProps)) : /*#__PURE__*/React.createElement(ListItem, _extends({
|
|
739
|
+
key: listIndex,
|
|
740
|
+
dataId: item[keyName],
|
|
741
|
+
value: item[keyName],
|
|
742
|
+
id: item[idName],
|
|
743
|
+
active: selectedId === item[idName],
|
|
744
|
+
onClick: this.onSelect.bind(this, item),
|
|
745
|
+
isDisabled: isDisabled,
|
|
746
|
+
disableTitle: disableTitle,
|
|
747
|
+
index: listIndex // highlight={selectedIndex === listIndex}
|
|
748
|
+
,
|
|
749
|
+
needTick: needTick,
|
|
750
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
751
|
+
,
|
|
752
|
+
getRef: this.itemRef,
|
|
753
|
+
title: title ? title : item[keyName],
|
|
754
|
+
palette: palette,
|
|
755
|
+
needMultiLineText: needMultiLineText,
|
|
756
|
+
autoHover: true,
|
|
757
|
+
a11y: {
|
|
758
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
759
|
+
ariaSelected: selectedId === item[idName],
|
|
760
|
+
ariaLabel: item[keyName]
|
|
761
|
+
}
|
|
762
|
+
}, ListItemProps));
|
|
763
|
+
}));
|
|
764
|
+
}), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
|
|
765
|
+
isCover: false,
|
|
766
|
+
align: "both"
|
|
767
|
+
}, /*#__PURE__*/React.createElement(Loader, null))) : /*#__PURE__*/React.createElement(React.Fragment, null, options.map((item, i) => {
|
|
768
|
+
const {
|
|
769
|
+
iconName,
|
|
770
|
+
iconSize,
|
|
771
|
+
iconClass,
|
|
772
|
+
title,
|
|
773
|
+
needDivider,
|
|
774
|
+
isDisabled = false,
|
|
775
|
+
disableTitle = ''
|
|
776
|
+
} = item;
|
|
777
|
+
|
|
778
|
+
if (!needDivider) {
|
|
779
|
+
listIndex += 1;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
783
|
+
key: i
|
|
784
|
+
}, needDivider ? /*#__PURE__*/React.createElement("div", {
|
|
785
|
+
className: style.seperatedLine
|
|
786
|
+
}) : iconName ? /*#__PURE__*/React.createElement(ListItemWithIcon, _extends({
|
|
787
|
+
dataId: item[keyName],
|
|
788
|
+
value: item[keyName],
|
|
789
|
+
id: item[idName],
|
|
790
|
+
active: selectedId === item[idName],
|
|
791
|
+
onClick: this.onSelect.bind(this, item),
|
|
792
|
+
index: listIndex,
|
|
793
|
+
disableTitle: disableTitle,
|
|
794
|
+
isDisabled: isDisabled // highlight={selectedIndex === listIndex}
|
|
795
|
+
,
|
|
796
|
+
iconName: iconName,
|
|
797
|
+
iconClass: iconClass,
|
|
798
|
+
iconSize: iconSize,
|
|
799
|
+
needTick: needTick,
|
|
800
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
801
|
+
,
|
|
802
|
+
getRef: this.itemRef,
|
|
803
|
+
title: title ? title : item[keyName],
|
|
804
|
+
key: listIndex,
|
|
805
|
+
palette: palette,
|
|
806
|
+
needMultiLineText: needMultiLineText,
|
|
807
|
+
autoHover: true,
|
|
808
|
+
a11y: {
|
|
809
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
810
|
+
ariaSelected: selectedId === item[idName],
|
|
811
|
+
ariaLabel: item[keyName]
|
|
812
|
+
}
|
|
813
|
+
}, ListItemWithIconProps)) : /*#__PURE__*/React.createElement(ListItem, _extends({
|
|
814
|
+
key: listIndex,
|
|
815
|
+
dataId: item[keyName],
|
|
816
|
+
value: item[keyName],
|
|
817
|
+
id: item[idName],
|
|
818
|
+
disableTitle: disableTitle,
|
|
819
|
+
isDisabled: isDisabled,
|
|
820
|
+
active: selectedId === item[idName],
|
|
821
|
+
onClick: this.onSelect.bind(this, item),
|
|
822
|
+
index: listIndex // highlight={selectedIndex === listIndex}
|
|
823
|
+
,
|
|
824
|
+
needTick: needTick,
|
|
825
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
826
|
+
,
|
|
827
|
+
getRef: this.itemRef,
|
|
828
|
+
title: title ? title : item[keyName],
|
|
829
|
+
palette: palette,
|
|
830
|
+
needMultiLineText: needMultiLineText,
|
|
831
|
+
autoHover: true,
|
|
832
|
+
a11y: {
|
|
833
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
834
|
+
ariaSelected: selectedId === item[idName],
|
|
835
|
+
ariaLabel: item[keyName]
|
|
836
|
+
}
|
|
837
|
+
}, ListItemProps)));
|
|
838
|
+
}), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
|
|
839
|
+
isCover: false,
|
|
840
|
+
align: "both"
|
|
841
|
+
}, /*#__PURE__*/React.createElement(Loader, null))) : /*#__PURE__*/React.createElement(CommonEmptyState, {
|
|
842
|
+
className: style.svgWrapper,
|
|
843
|
+
description: searchEmptyHint,
|
|
844
|
+
title: searchErrorText || 'No results',
|
|
845
|
+
size: "small",
|
|
846
|
+
getEmptyState: this.emptySearchSVG
|
|
847
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
848
|
+
className: style.loader
|
|
849
|
+
}, /*#__PURE__*/React.createElement(Loader, null))), getFooter ? /*#__PURE__*/React.createElement(Box, null, getFooter()) : null));
|
|
850
|
+
}) : null);
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
}
|
|
854
|
+
ToggleDropDown.defaultProps = defaultProps;
|
|
855
|
+
ToggleDropDown.propTypes = propTypes; // if (__DOCS__) {
|
|
856
|
+
// ToggleDropDown.docs = {
|
|
857
|
+
// componentGroup: 'Molecule'
|
|
858
|
+
// };
|
|
859
|
+
// }
|
|
860
|
+
|
|
861
|
+
export default Popup(ToggleDropDown);
|