@zohodesk/dot 1.2.2 → 1.2.4
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 +9 -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/coverage-final.json +12 -12
- package/coverage/coverage-summary.json +12 -12
- package/coverage/index.html +1 -1
- package/es/Drawer/Drawer.js +10 -10
- package/es/TagWithIcon/props/propTypes.js +1 -1
- package/es/dropdown/ToggleDropDown/ToggleDropDown.js +5 -2
- package/es/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +7 -3
- package/es/layout/SubtabLayout/props/propTypes.js +1 -1
- package/es/list/status/StatusDropdown/StatusDropdown.js +4 -1
- package/es/list/status/StatusDropdown/props/propTypes.js +2 -1
- package/es/lookup/Lookup/Lookup.js +10 -10
- 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 +11 -11
- 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 +12 -10
- 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/lib/Drawer/Drawer.js +15 -15
- package/lib/TagWithIcon/props/propTypes.js +1 -1
- package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +5 -3
- package/lib/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +8 -5
- package/lib/layout/SubtabLayout/props/propTypes.js +1 -1
- package/lib/list/status/StatusDropdown/StatusDropdown.js +4 -3
- package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/lib/lookup/Lookup/Lookup.js +15 -15
- 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 +16 -16
- 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 +17 -15
- 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/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,932 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.ToggleDropDown = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _defaultProps = require("../../../dropdown/ToggleDropDown/props/defaultProps");
|
|
13
|
+
|
|
14
|
+
var _propTypes = require("../../../dropdown/ToggleDropDown/props/propTypes");
|
|
15
|
+
|
|
16
|
+
var _icons = require("@zohodesk/icons");
|
|
17
|
+
|
|
18
|
+
var _Popup = _interopRequireDefault(require("@zohodesk/components/lib/Popup/Popup"));
|
|
19
|
+
|
|
20
|
+
var _Layout = require("@zohodesk/components/lib/Layout");
|
|
21
|
+
|
|
22
|
+
var _ListItem = _interopRequireDefault(require("@zohodesk/components/lib/ListItem/ListItem"));
|
|
23
|
+
|
|
24
|
+
var _ListItemWithIcon = _interopRequireDefault(require("@zohodesk/components/lib/ListItem/ListItemWithIcon"));
|
|
25
|
+
|
|
26
|
+
var _DropDownHeading = _interopRequireDefault(require("@zohodesk/components/lib/DropDown/DropDownHeading"));
|
|
27
|
+
|
|
28
|
+
var _TextBoxIcon = _interopRequireDefault(require("@zohodesk/components/lib/TextBoxIcon/TextBoxIcon"));
|
|
29
|
+
|
|
30
|
+
var _Loader = _interopRequireDefault(require("@zohodesk/svg/lib/Loader/Loader"));
|
|
31
|
+
|
|
32
|
+
var _CommonEmptyState = _interopRequireDefault(require("../../emptystate/CommonEmptyState/CommonEmptyState"));
|
|
33
|
+
|
|
34
|
+
var _EmptySearch = _interopRequireDefault(require("@zohodesk/svg/lib/emptystate/version3/EmptySearch"));
|
|
35
|
+
|
|
36
|
+
var _CssProvider = _interopRequireDefault(require("@zohodesk/components/lib/Provider/CssProvider"));
|
|
37
|
+
|
|
38
|
+
var _Common = require("@zohodesk/components/lib/utils/Common");
|
|
39
|
+
|
|
40
|
+
var _IdProvider = require("@zohodesk/components/lib/Provider/IdProvider");
|
|
41
|
+
|
|
42
|
+
var _semanticButtonModule = _interopRequireDefault(require("@zohodesk/components/lib/semantic/Button/semanticButton.module.css"));
|
|
43
|
+
|
|
44
|
+
var _RippleEffect = _interopRequireDefault(require("@zohodesk/components/lib/RippleEffect/RippleEffect"));
|
|
45
|
+
|
|
46
|
+
var _ResponsiveDropBox = _interopRequireDefault(require("@zohodesk/components/lib/ResponsiveDropBox/ResponsiveDropBox"));
|
|
47
|
+
|
|
48
|
+
var _CustomResponsive = require("@zohodesk/components/lib/Responsive/CustomResponsive");
|
|
49
|
+
|
|
50
|
+
var _ToggleDropDownModule = _interopRequireDefault(require("../../../dropdown/ToggleDropDown/ToggleDropDown.module.css"));
|
|
51
|
+
|
|
52
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
53
|
+
|
|
54
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
55
|
+
|
|
56
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
57
|
+
|
|
58
|
+
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); }
|
|
59
|
+
|
|
60
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
61
|
+
|
|
62
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
63
|
+
|
|
64
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
65
|
+
|
|
66
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
67
|
+
|
|
68
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
69
|
+
|
|
70
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
71
|
+
|
|
72
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
73
|
+
|
|
74
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
75
|
+
|
|
76
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
77
|
+
|
|
78
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
79
|
+
|
|
80
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
81
|
+
|
|
82
|
+
var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
83
|
+
_inherits(ToggleDropDown, _Component);
|
|
84
|
+
|
|
85
|
+
var _super = _createSuper(ToggleDropDown);
|
|
86
|
+
|
|
87
|
+
function ToggleDropDown(props) {
|
|
88
|
+
var _this;
|
|
89
|
+
|
|
90
|
+
_classCallCheck(this, ToggleDropDown);
|
|
91
|
+
|
|
92
|
+
_this = _super.call(this, props);
|
|
93
|
+
_this.state = {
|
|
94
|
+
searchValue: '',
|
|
95
|
+
// selectedIndex: -1,
|
|
96
|
+
options: props.options,
|
|
97
|
+
isFetchingOptions: false
|
|
98
|
+
};
|
|
99
|
+
_this._isMounted = false;
|
|
100
|
+
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this)); // this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
101
|
+
|
|
102
|
+
_this.onSelect = _this.onSelect.bind(_assertThisInitialized(_this));
|
|
103
|
+
_this.handleTogglePopup = _this.handleTogglePopup.bind(_assertThisInitialized(_this));
|
|
104
|
+
_this.showTogglePopup = _this.showTogglePopup.bind(_assertThisInitialized(_this));
|
|
105
|
+
_this.hideTogglePopup = _this.hideTogglePopup.bind(_assertThisInitialized(_this));
|
|
106
|
+
_this.onSearchAPI = _this.onSearchAPI.bind(_assertThisInitialized(_this));
|
|
107
|
+
_this.onSearchClear = _this.onSearchClear.bind(_assertThisInitialized(_this));
|
|
108
|
+
_this.handleFilterSuggestions = _this.handleFilterSuggestions.bind(_assertThisInitialized(_this));
|
|
109
|
+
_this.scrollContentRef = _this.scrollContentRef.bind(_assertThisInitialized(_this)); // this.handleMouseEnter = this.handleMouseEnter.bind(this);
|
|
110
|
+
|
|
111
|
+
_this.searchInputRef = _this.searchInputRef.bind(_assertThisInitialized(_this));
|
|
112
|
+
_this.itemRef = _this.itemRef.bind(_assertThisInitialized(_this)); // this.inputRef = this.inputRef.bind(this);
|
|
113
|
+
|
|
114
|
+
_this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this)); // this.getOptionsArray = this.getOptionsArray.bind(this);
|
|
115
|
+
|
|
116
|
+
_this.emptySearchSVG = _this.emptySearchSVG.bind(_assertThisInitialized(_this));
|
|
117
|
+
_this.getAriaId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this)); // this.getSelectedIndex = this.getSelectedIndex.bind(this);
|
|
118
|
+
|
|
119
|
+
_this.handleGetNextOptions = _this.handleGetNextOptions.bind(_assertThisInitialized(_this));
|
|
120
|
+
_this.handleFetchOptions = _this.handleFetchOptions.bind(_assertThisInitialized(_this));
|
|
121
|
+
return _this;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
_createClass(ToggleDropDown, [{
|
|
125
|
+
key: "componentDidMount",
|
|
126
|
+
value: function componentDidMount() {
|
|
127
|
+
this._isMounted = true;
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "componentWillUnmount",
|
|
131
|
+
value: function componentWillUnmount() {
|
|
132
|
+
this._isMounted = false;
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "emptySearchSVG",
|
|
136
|
+
value: function emptySearchSVG() {
|
|
137
|
+
return /*#__PURE__*/_react["default"].createElement(_EmptySearch["default"], {
|
|
138
|
+
size: "small"
|
|
139
|
+
});
|
|
140
|
+
} // inputRef(el) {
|
|
141
|
+
// this.hiddenInput = el;
|
|
142
|
+
// }
|
|
143
|
+
|
|
144
|
+
}, {
|
|
145
|
+
key: "itemRef",
|
|
146
|
+
value: function itemRef(ele, index, id) {
|
|
147
|
+
this["suggestion_".concat(id)] = ele;
|
|
148
|
+
}
|
|
149
|
+
}, {
|
|
150
|
+
key: "searchInputRef",
|
|
151
|
+
value: function searchInputRef(el) {
|
|
152
|
+
this.searchInput = el;
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
key: "handleTogglePopup",
|
|
156
|
+
value: function handleTogglePopup(e) {
|
|
157
|
+
var _this$props = this.props,
|
|
158
|
+
togglePopup = _this$props.togglePopup,
|
|
159
|
+
boxPosition = _this$props.boxPosition,
|
|
160
|
+
onSelectLabel = _this$props.onSelectLabel,
|
|
161
|
+
isPopupOpen = _this$props.isPopupOpen,
|
|
162
|
+
removeClose = _this$props.removeClose;
|
|
163
|
+
removeClose && removeClose(e);
|
|
164
|
+
!isPopupOpen && onSelectLabel && onSelectLabel(e);
|
|
165
|
+
togglePopup(e, boxPosition);
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
key: "showTogglePopup",
|
|
169
|
+
value: function showTogglePopup(e) {
|
|
170
|
+
var _this$props2 = this.props,
|
|
171
|
+
togglePopup = _this$props2.togglePopup,
|
|
172
|
+
boxPosition = _this$props2.boxPosition,
|
|
173
|
+
onSelectLabel = _this$props2.onSelectLabel,
|
|
174
|
+
isPopupOpen = _this$props2.isPopupOpen;
|
|
175
|
+
!isPopupOpen && onSelectLabel && onSelectLabel(e);
|
|
176
|
+
!isPopupOpen && togglePopup(e, boxPosition);
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
key: "hideTogglePopup",
|
|
180
|
+
value: function hideTogglePopup(e) {
|
|
181
|
+
var _this$props3 = this.props,
|
|
182
|
+
togglePopup = _this$props3.togglePopup,
|
|
183
|
+
boxPosition = _this$props3.boxPosition,
|
|
184
|
+
onSelectLabel = _this$props3.onSelectLabel,
|
|
185
|
+
isPopupOpen = _this$props3.isPopupOpen;
|
|
186
|
+
!isPopupOpen && onSelectLabel && onSelectLabel(e);
|
|
187
|
+
isPopupOpen && togglePopup(e, boxPosition);
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
190
|
+
key: "scrollContentRef",
|
|
191
|
+
value: function scrollContentRef(el) {
|
|
192
|
+
var isPopupOpen = this.props.isPopupOpen;
|
|
193
|
+
|
|
194
|
+
if (isPopupOpen) {
|
|
195
|
+
this.optionsContainer = el;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
200
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
201
|
+
this.setState({
|
|
202
|
+
options: nextProps.options
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
key: "onSelect",
|
|
207
|
+
value: function onSelect(element, e) {
|
|
208
|
+
var _this$props4 = this.props,
|
|
209
|
+
onClick = _this$props4.onClick,
|
|
210
|
+
togglePopup = _this$props4.togglePopup,
|
|
211
|
+
preventPopupClose = _this$props4.preventPopupClose;
|
|
212
|
+
onClick && onClick(e, element);
|
|
213
|
+
!preventPopupClose && togglePopup(e);
|
|
214
|
+
}
|
|
215
|
+
}, {
|
|
216
|
+
key: "componentDidUpdate",
|
|
217
|
+
value: function componentDidUpdate(prevProps) {
|
|
218
|
+
var _this$props5 = this.props,
|
|
219
|
+
isPopupOpen = _this$props5.isPopupOpen,
|
|
220
|
+
isPopupReady = _this$props5.isPopupReady,
|
|
221
|
+
isSearch = _this$props5.isSearch,
|
|
222
|
+
idName = _this$props5.idName,
|
|
223
|
+
options = _this$props5.options,
|
|
224
|
+
onDropDownOpen = _this$props5.onDropDownOpen,
|
|
225
|
+
onDropDownClose = _this$props5.onDropDownClose;
|
|
226
|
+
var _this$state = this.state,
|
|
227
|
+
selectedIndex = _this$state.selectedIndex,
|
|
228
|
+
searchValue = _this$state.searchValue; // eslint-disable-next-line
|
|
229
|
+
|
|
230
|
+
if (prevProps.isPopupReady !== isPopupReady) {// setTimeout(() => {
|
|
231
|
+
// isPopupReady
|
|
232
|
+
// ? isSearch
|
|
233
|
+
// ? this.searchInput.focus({ preventScroll: true })
|
|
234
|
+
// : this.hiddenInput.focus({ preventScroll: true })
|
|
235
|
+
// : this.hiddenInput.focus({ preventScroll: true });
|
|
236
|
+
// }, 10);
|
|
237
|
+
} // const optionsArr = this.getOptionsArray();
|
|
238
|
+
// const option = optionsArr[selectedIndex];
|
|
239
|
+
// const id = (option && option[idName]) || {};
|
|
240
|
+
// const selSuggestion = this[`suggestion_${id}`];
|
|
241
|
+
// if (isPopupOpen) {
|
|
242
|
+
// this.optionsContainer && scrollTo(this.optionsContainer, selSuggestion);
|
|
243
|
+
// }
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
if (!prevProps.isPopupOpen && isPopupOpen && searchValue.length) {
|
|
247
|
+
this.onSearchClear();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (this.props.from == 'activityFilter') {
|
|
251
|
+
//Temproary
|
|
252
|
+
var results = this.props.options.filter(function (_ref) {
|
|
253
|
+
var id1 = _ref.isDisabled;
|
|
254
|
+
return !prevProps.options.some(function (_ref2) {
|
|
255
|
+
var id2 = _ref2.isDisabled;
|
|
256
|
+
return id2 === id1;
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
if (results.length > 0) {
|
|
261
|
+
this.setState({
|
|
262
|
+
options: options
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (prevProps.isPopupOpen !== isPopupOpen) {
|
|
268
|
+
if (isPopupOpen) {
|
|
269
|
+
onDropDownOpen && onDropDownOpen();
|
|
270
|
+
} else {
|
|
271
|
+
onDropDownClose && onDropDownClose();
|
|
272
|
+
} // this.getSelectedIndex(optionsArr);
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}, {
|
|
277
|
+
key: "handleFilterSuggestions",
|
|
278
|
+
value: function handleFilterSuggestions(searchValue) {
|
|
279
|
+
var _this$props6 = this.props,
|
|
280
|
+
options = _this$props6.options,
|
|
281
|
+
keyName = _this$props6.keyName,
|
|
282
|
+
isGroupDropDown = _this$props6.isGroupDropDown,
|
|
283
|
+
groupOptionsKey = _this$props6.groupOptionsKey,
|
|
284
|
+
groupNameKey = _this$props6.groupNameKey;
|
|
285
|
+
searchValue = searchValue.trim().toLowerCase();
|
|
286
|
+
var result = [];
|
|
287
|
+
|
|
288
|
+
if (isGroupDropDown) {
|
|
289
|
+
var filteredGroups = [];
|
|
290
|
+
options.map(function (group) {
|
|
291
|
+
var needDivider = group.needDivider;
|
|
292
|
+
var name = group[groupNameKey];
|
|
293
|
+
var groupOptions = group[groupOptionsKey];
|
|
294
|
+
var datas = groupOptions.filter(function (list) {
|
|
295
|
+
var value = list[keyName];
|
|
296
|
+
return value.toLowerCase().includes(searchValue);
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
if (datas.length) {
|
|
300
|
+
var _filteredGroups$push;
|
|
301
|
+
|
|
302
|
+
filteredGroups.push((_filteredGroups$push = {}, _defineProperty(_filteredGroups$push, groupNameKey, name), _defineProperty(_filteredGroups$push, groupOptionsKey, datas), _defineProperty(_filteredGroups$push, "needDivider", needDivider), _filteredGroups$push));
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
result = filteredGroups;
|
|
306
|
+
} else {
|
|
307
|
+
var filteredOptions = options.filter(function (item, i) {
|
|
308
|
+
if (item.needDivider) {
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return item[keyName].toLowerCase().includes(searchValue);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
if (filteredOptions.length) {
|
|
316
|
+
// to avoid more than one dividers consecutively comes as one by one
|
|
317
|
+
var needDividerCount = 0;
|
|
318
|
+
var orderedOptions = filteredOptions.filter(function (item) {
|
|
319
|
+
if (item.needDivider && needDividerCount === 0) {
|
|
320
|
+
needDividerCount++;
|
|
321
|
+
return true;
|
|
322
|
+
} else if (!item.needDivider) {
|
|
323
|
+
needDividerCount = 0;
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
}); // remove divider if it placed in first or last index
|
|
327
|
+
|
|
328
|
+
filteredOptions = [];
|
|
329
|
+
filteredOptions = orderedOptions.filter(function (item, i) {
|
|
330
|
+
if (i == 0 || i == orderedOptions.length - 1) {
|
|
331
|
+
if (!item.needDivider) {
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
} else {
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
result = filteredOptions;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return result;
|
|
343
|
+
} // getOptionsArray() {
|
|
344
|
+
// const { searchValue } = this.state;
|
|
345
|
+
// const { isGroupDropDown, groupOptionsKey } = this.props;
|
|
346
|
+
// const options = searchValue.length ? this.handleFilterSuggestions(searchValue) : this.props.options;
|
|
347
|
+
// let optionsArr = [];
|
|
348
|
+
// if (isGroupDropDown) {
|
|
349
|
+
// for (let i = 0; i < options.length; i++) {
|
|
350
|
+
// const groupOptions = options[i][groupOptionsKey];
|
|
351
|
+
// Array.prototype.push.apply(optionsArr, groupOptions);
|
|
352
|
+
// }
|
|
353
|
+
// } else {
|
|
354
|
+
// optionsArr = options.filter((item) => !item.needDivider);
|
|
355
|
+
// }
|
|
356
|
+
// return optionsArr;
|
|
357
|
+
// }
|
|
358
|
+
// handleKeyDown(e) {
|
|
359
|
+
// const { keyCode } = e;
|
|
360
|
+
// const { selectedIndex, searchValue } = this.state;
|
|
361
|
+
// const optionsArr = this.getOptionsArray();
|
|
362
|
+
// const totalIndex = optionsArr.length;
|
|
363
|
+
// const { togglePopup, onClick, boxPosition, isPopupReady, value, keyName, idName, preventPopupClose, isSearch } =
|
|
364
|
+
// this.props;
|
|
365
|
+
// if (isPopupReady && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
|
|
366
|
+
// e.preventDefault(); //prevent body scroll
|
|
367
|
+
// }
|
|
368
|
+
// if (isPopupReady) {
|
|
369
|
+
// switch (keyCode) {
|
|
370
|
+
// case 40:
|
|
371
|
+
// if (selectedIndex === totalIndex - 1) {
|
|
372
|
+
// this.setState({ selectedIndex: 0 });
|
|
373
|
+
// } else {
|
|
374
|
+
// if (selectedIndex === totalIndex - 3) {
|
|
375
|
+
// this.handleGetNextOptions();
|
|
376
|
+
// }
|
|
377
|
+
// this.setState({
|
|
378
|
+
// selectedIndex: selectedIndex + 1
|
|
379
|
+
// });
|
|
380
|
+
// }
|
|
381
|
+
// break;
|
|
382
|
+
// case 38:
|
|
383
|
+
// if (selectedIndex === 0) {
|
|
384
|
+
// this.setState({ selectedIndex: totalIndex - 1 });
|
|
385
|
+
// } else {
|
|
386
|
+
// this.setState({
|
|
387
|
+
// selectedIndex: selectedIndex - 1
|
|
388
|
+
// });
|
|
389
|
+
// }
|
|
390
|
+
// break;
|
|
391
|
+
// case 13: {
|
|
392
|
+
// const selectedId = optionsArr[selectedIndex][idName] || '';
|
|
393
|
+
// onClick && onClick(selectedId, optionsArr[selectedIndex]);
|
|
394
|
+
// if (!preventPopupClose) {
|
|
395
|
+
// togglePopup(e, boxPosition);
|
|
396
|
+
// } else if (isSearch) {
|
|
397
|
+
// this.searchInput.focus({ preventScroll: true });
|
|
398
|
+
// } else {
|
|
399
|
+
// this.hiddenInput.focus({ preventScroll: true });
|
|
400
|
+
// }
|
|
401
|
+
// break;
|
|
402
|
+
// }
|
|
403
|
+
// }
|
|
404
|
+
// } else {
|
|
405
|
+
// if (keyCode === 13 || keyCode === 40) {
|
|
406
|
+
// togglePopup(e, boxPosition);
|
|
407
|
+
// }
|
|
408
|
+
// }
|
|
409
|
+
// }
|
|
410
|
+
// getSelectedIndex(optionsArr) {
|
|
411
|
+
// const { selectedId, idName } = this.props;
|
|
412
|
+
// if (selectedId) {
|
|
413
|
+
// for (let i = 0; i < optionsArr.length; i++) {
|
|
414
|
+
// const indexId = optionsArr[i][idName];
|
|
415
|
+
// if (selectedId === indexId) {
|
|
416
|
+
// this.setState({
|
|
417
|
+
// selectedIndex: i
|
|
418
|
+
// });
|
|
419
|
+
// break;
|
|
420
|
+
// }
|
|
421
|
+
// }
|
|
422
|
+
// } else {
|
|
423
|
+
// this.setState({
|
|
424
|
+
// selectedIndex: -1
|
|
425
|
+
// });
|
|
426
|
+
// }
|
|
427
|
+
// }
|
|
428
|
+
|
|
429
|
+
}, {
|
|
430
|
+
key: "onSearchAPI",
|
|
431
|
+
value: function onSearchAPI() {
|
|
432
|
+
var searchValue = this.state.searchValue;
|
|
433
|
+
var _this$props7 = this.props,
|
|
434
|
+
needSearchFetching = _this$props7.needSearchFetching,
|
|
435
|
+
onSearch = _this$props7.onSearch;
|
|
436
|
+
|
|
437
|
+
if (needSearchFetching && onSearch) {
|
|
438
|
+
onSearch(searchValue);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}, {
|
|
442
|
+
key: "handleChange",
|
|
443
|
+
value: function handleChange(value, e) {
|
|
444
|
+
var _this2 = this;
|
|
445
|
+
|
|
446
|
+
var filteredOptions = this.handleFilterSuggestions(value);
|
|
447
|
+
this.setState({
|
|
448
|
+
searchValue: value,
|
|
449
|
+
// selectedIndex: -1,
|
|
450
|
+
options: filteredOptions
|
|
451
|
+
}, function () {
|
|
452
|
+
_this2.onSearchAPI();
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
}, {
|
|
456
|
+
key: "onSearchClear",
|
|
457
|
+
value: function onSearchClear() {
|
|
458
|
+
var _this3 = this;
|
|
459
|
+
|
|
460
|
+
var filteredOptions = this.handleFilterSuggestions('');
|
|
461
|
+
this.setState({
|
|
462
|
+
searchValue: '',
|
|
463
|
+
options: filteredOptions
|
|
464
|
+
}, function () {
|
|
465
|
+
_this3.onSearchAPI();
|
|
466
|
+
});
|
|
467
|
+
} // handleMouseEnter(id, value, index, e) {
|
|
468
|
+
// this.setState({
|
|
469
|
+
// selectedIndex: index
|
|
470
|
+
// });
|
|
471
|
+
// }
|
|
472
|
+
|
|
473
|
+
}, {
|
|
474
|
+
key: "handleScroll",
|
|
475
|
+
value: function handleScroll(e) {
|
|
476
|
+
var ele = e.target;
|
|
477
|
+
var isScrollReachedBottom = (0, _Common.findScrollEnd)(ele);
|
|
478
|
+
isScrollReachedBottom && this.handleGetNextOptions();
|
|
479
|
+
}
|
|
480
|
+
}, {
|
|
481
|
+
key: "handleGetNextOptions",
|
|
482
|
+
value: function handleGetNextOptions() {
|
|
483
|
+
var _this$props8 = this.props,
|
|
484
|
+
isNextOptions = _this$props8.isNextOptions,
|
|
485
|
+
getNextOptions = _this$props8.getNextOptions;
|
|
486
|
+
var searchValue = this.state.searchValue;
|
|
487
|
+
isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchValue);
|
|
488
|
+
}
|
|
489
|
+
}, {
|
|
490
|
+
key: "handleFetchOptions",
|
|
491
|
+
value: function handleFetchOptions(APICall) {
|
|
492
|
+
var _this4 = this;
|
|
493
|
+
|
|
494
|
+
var searchValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
495
|
+
var _this$state$isFetchin = this.state.isFetchingOptions,
|
|
496
|
+
isFetchingOptions = _this$state$isFetchin === void 0 ? false : _this$state$isFetchin;
|
|
497
|
+
var _isMounted = this._isMounted;
|
|
498
|
+
|
|
499
|
+
if (!isFetchingOptions && APICall) {
|
|
500
|
+
this.setState({
|
|
501
|
+
isFetchingOptions: true
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
try {
|
|
505
|
+
return APICall(searchValue).then(function () {
|
|
506
|
+
_isMounted && _this4.setState({
|
|
507
|
+
isFetchingOptions: false
|
|
508
|
+
});
|
|
509
|
+
}, function () {
|
|
510
|
+
_isMounted && _this4.setState({
|
|
511
|
+
isFetchingOptions: false
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
} catch (e) {
|
|
515
|
+
_isMounted && this.setState({
|
|
516
|
+
isFetchingOptions: false
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}, {
|
|
522
|
+
key: "responsiveFunc",
|
|
523
|
+
value: function responsiveFunc(_ref3) {
|
|
524
|
+
var mediaQueryOR = _ref3.mediaQueryOR;
|
|
525
|
+
return {
|
|
526
|
+
tabletMode: mediaQueryOR([{
|
|
527
|
+
maxWidth: 700
|
|
528
|
+
}])
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
}, {
|
|
532
|
+
key: "render",
|
|
533
|
+
value: function render() {
|
|
534
|
+
var _this5 = this;
|
|
535
|
+
|
|
536
|
+
var _this$state2 = this.state,
|
|
537
|
+
options = _this$state2.options,
|
|
538
|
+
selectedIndex = _this$state2.selectedIndex;
|
|
539
|
+
var _this$props9 = this.props,
|
|
540
|
+
value = _this$props9.value,
|
|
541
|
+
removeClose = _this$props9.removeClose,
|
|
542
|
+
boxSize = _this$props9.boxSize,
|
|
543
|
+
keyName = _this$props9.keyName,
|
|
544
|
+
idName = _this$props9.idName,
|
|
545
|
+
title = _this$props9.title,
|
|
546
|
+
isSearch = _this$props9.isSearch,
|
|
547
|
+
isArrow = _this$props9.isArrow,
|
|
548
|
+
placeHolderText = _this$props9.placeHolderText,
|
|
549
|
+
className = _this$props9.className,
|
|
550
|
+
right = _this$props9.right,
|
|
551
|
+
left = _this$props9.left,
|
|
552
|
+
top = _this$props9.top,
|
|
553
|
+
bottom = _this$props9.bottom,
|
|
554
|
+
isOpen = _this$props9.isPopupOpen,
|
|
555
|
+
isPopupActive = _this$props9.isPopupActive,
|
|
556
|
+
needExternalPopupState = _this$props9.needExternalPopupState,
|
|
557
|
+
isPopupReady = _this$props9.isPopupReady,
|
|
558
|
+
position = _this$props9.position,
|
|
559
|
+
getTargetRef = _this$props9.getTargetRef,
|
|
560
|
+
getContainerRef = _this$props9.getContainerRef,
|
|
561
|
+
dataId = _this$props9.dataId,
|
|
562
|
+
dataSelectorId = _this$props9.dataSelectorId,
|
|
563
|
+
searchBoxSize = _this$props9.searchBoxSize,
|
|
564
|
+
searchEmptyHint = _this$props9.searchEmptyHint,
|
|
565
|
+
searchErrorText = _this$props9.searchErrorText,
|
|
566
|
+
activeStyle = _this$props9.activeStyle,
|
|
567
|
+
showOnHover = _this$props9.showOnHover,
|
|
568
|
+
isDisabled = _this$props9.isDisabled,
|
|
569
|
+
showIconOnHover = _this$props9.showIconOnHover,
|
|
570
|
+
isReadOnly = _this$props9.isReadOnly,
|
|
571
|
+
hoverStyle = _this$props9.hoverStyle,
|
|
572
|
+
isEditable = _this$props9.isEditable,
|
|
573
|
+
iconName = _this$props9.iconName,
|
|
574
|
+
iconSize = _this$props9.iconSize,
|
|
575
|
+
needTick = _this$props9.needTick,
|
|
576
|
+
dataTitle = _this$props9.dataTitle,
|
|
577
|
+
isDataLoaded = _this$props9.isDataLoaded,
|
|
578
|
+
children = _this$props9.children,
|
|
579
|
+
needResponsive = _this$props9.needResponsive,
|
|
580
|
+
arrowIconPosition = _this$props9.arrowIconPosition,
|
|
581
|
+
isGroupDropDown = _this$props9.isGroupDropDown,
|
|
582
|
+
groupOptionsKey = _this$props9.groupOptionsKey,
|
|
583
|
+
groupNameKey = _this$props9.groupNameKey,
|
|
584
|
+
isToggleStateNeeded = _this$props9.isToggleStateNeeded,
|
|
585
|
+
selectedId = _this$props9.selectedId,
|
|
586
|
+
isPadding = _this$props9.isPadding,
|
|
587
|
+
isNeedEffect = _this$props9.isNeedEffect,
|
|
588
|
+
hoverType = _this$props9.hoverType,
|
|
589
|
+
palette = _this$props9.palette,
|
|
590
|
+
getFooter = _this$props9.getFooter,
|
|
591
|
+
customProps = _this$props9.customProps,
|
|
592
|
+
needMultiLineText = _this$props9.needMultiLineText,
|
|
593
|
+
customClass = _this$props9.customClass;
|
|
594
|
+
var _customProps$ToggleDr = customProps.ToggleDropDownProps,
|
|
595
|
+
ToggleDropDownProps = _customProps$ToggleDr === void 0 ? {} : _customProps$ToggleDr,
|
|
596
|
+
_customProps$DropBoxP = customProps.DropBoxProps,
|
|
597
|
+
DropBoxProps = _customProps$DropBoxP === void 0 ? {} : _customProps$DropBoxP,
|
|
598
|
+
_customProps$TextBoxI = customProps.TextBoxIconProps,
|
|
599
|
+
TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI,
|
|
600
|
+
_customProps$ListItem = customProps.ListItemWithIconProps,
|
|
601
|
+
ListItemWithIconProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
|
|
602
|
+
_customProps$ListItem2 = customProps.ListItemProps,
|
|
603
|
+
ListItemProps = _customProps$ListItem2 === void 0 ? {} : _customProps$ListItem2;
|
|
604
|
+
var _customClass$customDr = customClass.customDropBox,
|
|
605
|
+
customDropBox = _customClass$customDr === void 0 ? '' : _customClass$customDr,
|
|
606
|
+
_customClass$customLi = customClass.customListBox,
|
|
607
|
+
customListBox = _customClass$customLi === void 0 ? '' : _customClass$customLi;
|
|
608
|
+
var isPopupOpen = needExternalPopupState ? isPopupActive && isOpen : isOpen;
|
|
609
|
+
var Component = isToggleStateNeeded ? children.type : null,
|
|
610
|
+
componentProps = isToggleStateNeeded ? children.props : null;
|
|
611
|
+
var _this$state3 = this.state,
|
|
612
|
+
searchValue = _this$state3.searchValue,
|
|
613
|
+
isFetchingOptions = _this$state3.isFetchingOptions;
|
|
614
|
+
var commonClass = "".concat(className ? className : '', " ").concat(isPopupReady ? activeStyle ? activeStyle : '' : '', " ").concat(isDisabled ? (0, _CssProvider["default"])('isDisable') : isReadOnly || !isEditable ? _ToggleDropDownModule["default"].cursorDefault : !showOnHover ? "".concat(_ToggleDropDownModule["default"].cursor, " ").concat(hoverStyle ? hoverStyle : '') : "".concat(hoverStyle ? hoverStyle : '', " ").concat(_ToggleDropDownModule["default"].cursorDefault));
|
|
615
|
+
var listIndex = -1;
|
|
616
|
+
var ariaTitleId = this.getAriaId(); // const allyOptionsArr = this.getOptionsArray();
|
|
617
|
+
|
|
618
|
+
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
619
|
+
className: _ToggleDropDownModule["default"].wrapper,
|
|
620
|
+
onMouseEnter: showOnHover && !isDisabled && !isReadOnly && isEditable ? this.showTogglePopup : undefined,
|
|
621
|
+
onMouseLeave: showOnHover && !isDisabled && !isReadOnly && isEditable ? this.hideTogglePopup : undefined,
|
|
622
|
+
"data-selector-id": dataSelectorId
|
|
623
|
+
}, ToggleDropDownProps), /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
624
|
+
alignBox: "row",
|
|
625
|
+
onClick: !showOnHover && !isDisabled && !isReadOnly && isEditable && this.handleTogglePopup,
|
|
626
|
+
eleRef: getTargetRef,
|
|
627
|
+
align: "vertical",
|
|
628
|
+
isCover: false,
|
|
629
|
+
dataId: dataId
|
|
630
|
+
}, children ? isToggleStateNeeded ? /*#__PURE__*/_react["default"].createElement(Component, _extends({}, componentProps, {
|
|
631
|
+
isActive: isPopupOpen
|
|
632
|
+
})) : children : /*#__PURE__*/_react["default"].createElement(_RippleEffect["default"], {
|
|
633
|
+
hoverType: hoverType,
|
|
634
|
+
isActive: isPopupOpen,
|
|
635
|
+
isNeedEffect: isEditable && isNeedEffect
|
|
636
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
637
|
+
className: "".concat(_semanticButtonModule["default"].buttonReset, " ").concat(commonClass, " ").concat(!isPopupOpen && showIconOnHover ? _ToggleDropDownModule["default"].hoverIcon : ''),
|
|
638
|
+
isCover: false,
|
|
639
|
+
alignBox: "row",
|
|
640
|
+
align: "vertical",
|
|
641
|
+
tagName: "button",
|
|
642
|
+
"aria-labelledby": ariaTitleId,
|
|
643
|
+
"aria-haspopup": true,
|
|
644
|
+
"aria-expanded": isPopupOpen ? true : false
|
|
645
|
+
}, iconName ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
646
|
+
className: value ? _ToggleDropDownModule["default"].iconBox : ''
|
|
647
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
648
|
+
name: iconName,
|
|
649
|
+
size: iconSize
|
|
650
|
+
})) : null, value && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
651
|
+
id: ariaTitleId,
|
|
652
|
+
"aria-hidden": true,
|
|
653
|
+
className: "".concat(_ToggleDropDownModule["default"].value, " toggleDropText"),
|
|
654
|
+
shrink: true,
|
|
655
|
+
tagName: "span",
|
|
656
|
+
"data-title": dataTitle
|
|
657
|
+
}, value), isEditable ? /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
658
|
+
"aria-hidden": true,
|
|
659
|
+
size: "6",
|
|
660
|
+
name: "ZD-down",
|
|
661
|
+
iconClass: 'toggleDropIcon'.concat(" ", _ToggleDropDownModule["default"].arrow, " ").concat(_ToggleDropDownModule["default"]["".concat(arrowIconPosition, "_arrow")]),
|
|
662
|
+
dataId: "statusdownarrow"
|
|
663
|
+
}) : null)))), isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
|
|
664
|
+
query: this.responsiveFunc,
|
|
665
|
+
responsiveId: "Helmet"
|
|
666
|
+
}, function (_ref4) {
|
|
667
|
+
var tabletMode = _ref4.tabletMode;
|
|
668
|
+
return /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], _extends({
|
|
669
|
+
boxPosition: position,
|
|
670
|
+
isActive: isPopupReady,
|
|
671
|
+
onClick: removeClose,
|
|
672
|
+
size: boxSize,
|
|
673
|
+
right: right,
|
|
674
|
+
left: left,
|
|
675
|
+
top: top,
|
|
676
|
+
bottom: bottom,
|
|
677
|
+
isArrow: isArrow,
|
|
678
|
+
isAnimate: true,
|
|
679
|
+
getRef: getContainerRef,
|
|
680
|
+
customClass: {
|
|
681
|
+
customDropBoxWrap: _ToggleDropDownModule["default"].dropBoxContainer,
|
|
682
|
+
customDropBox: customDropBox
|
|
683
|
+
},
|
|
684
|
+
needResponsive: needResponsive,
|
|
685
|
+
isPadding: isPadding,
|
|
686
|
+
tabindex: "0",
|
|
687
|
+
a11y: {
|
|
688
|
+
role: !isSearch ? 'menu' : undefined,
|
|
689
|
+
ariaLabelledby: !isSearch ? ariaTitleId : undefined
|
|
690
|
+
},
|
|
691
|
+
palette: palette,
|
|
692
|
+
isResponsivePadding: true,
|
|
693
|
+
needFocusScope: true,
|
|
694
|
+
customProps: {
|
|
695
|
+
focusScopeProps: {
|
|
696
|
+
loadNextOptions: _this5.handleGetNextOptions,
|
|
697
|
+
searchValue: searchValue,
|
|
698
|
+
isFetchingOptions: isFetchingOptions
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}, DropBoxProps, {
|
|
702
|
+
onClose: _this5.handleTogglePopup
|
|
703
|
+
}), /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isSearch ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
704
|
+
className: _ToggleDropDownModule["default"].search
|
|
705
|
+
}, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], _extends({
|
|
706
|
+
placeHolder: placeHolderText,
|
|
707
|
+
onChange: _this5.handleChange,
|
|
708
|
+
value: searchValue,
|
|
709
|
+
onClear: _this5.onSearchClear,
|
|
710
|
+
size: searchBoxSize // inputRef={this.searchInputRef}
|
|
711
|
+
,
|
|
712
|
+
customProps: {
|
|
713
|
+
TextBoxProps: {
|
|
714
|
+
'data-a11y-autofocus': true
|
|
715
|
+
}
|
|
716
|
+
} //search
|
|
717
|
+
// onKeyDown={this.handleKeyDown}
|
|
718
|
+
,
|
|
719
|
+
a11y: {
|
|
720
|
+
role: 'combobox',
|
|
721
|
+
ariaOwns: ariaTitleId,
|
|
722
|
+
// ariaActivedescendant: allyOptionsArr[selectedIndex] && allyOptionsArr[selectedIndex][keyName],
|
|
723
|
+
ariaAutocomplete: 'list',
|
|
724
|
+
ariaHaspopup: true,
|
|
725
|
+
ariaExpanded: true
|
|
726
|
+
}
|
|
727
|
+
}, TextBoxIconProps))) : null, title && options.length != 0 && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
728
|
+
className: _ToggleDropDownModule["default"].title
|
|
729
|
+
}, /*#__PURE__*/_react["default"].createElement(_DropDownHeading["default"], {
|
|
730
|
+
text: title,
|
|
731
|
+
htmlId: ariaTitleId,
|
|
732
|
+
palette: palette,
|
|
733
|
+
a11y: {
|
|
734
|
+
role: 'heading'
|
|
735
|
+
},
|
|
736
|
+
customClass: _ToggleDropDownModule["default"].dropdown
|
|
737
|
+
})), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
738
|
+
id: ariaTitleId,
|
|
739
|
+
flexible: true,
|
|
740
|
+
shrink: true,
|
|
741
|
+
scroll: "vertical",
|
|
742
|
+
preventParentScroll: "vertical",
|
|
743
|
+
dataId: "".concat(dataId, "_list"),
|
|
744
|
+
className: "".concat(tabletMode ? _ToggleDropDownModule["default"].responsivemaxHgt : _ToggleDropDownModule["default"].maxHgt, " ").concat(customListBox),
|
|
745
|
+
eleRef: _this5.scrollContentRef,
|
|
746
|
+
onScroll: _this5.handleScroll,
|
|
747
|
+
role: isSearch ? 'listbox' : 'menu',
|
|
748
|
+
"aria-labelledby": isSearch ? ariaTitleId : undefined,
|
|
749
|
+
"data-scroll": "true"
|
|
750
|
+
}, isDataLoaded ? options && options.length != 0 ? isGroupDropDown ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, options.map(function (group) {
|
|
751
|
+
var groupName = group[groupNameKey];
|
|
752
|
+
var groupOptions = group[groupOptionsKey];
|
|
753
|
+
var needDivider = group.needDivider;
|
|
754
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
|
|
755
|
+
key: "index".concat(groupName)
|
|
756
|
+
}, needDivider && /*#__PURE__*/_react["default"].createElement("div", {
|
|
757
|
+
className: _ToggleDropDownModule["default"].seperatedLine
|
|
758
|
+
}), groupName && /*#__PURE__*/_react["default"].createElement("div", {
|
|
759
|
+
className: _ToggleDropDownModule["default"].groupName
|
|
760
|
+
}, /*#__PURE__*/_react["default"].createElement(_DropDownHeading["default"], {
|
|
761
|
+
text: groupName,
|
|
762
|
+
palette: palette,
|
|
763
|
+
a11y: {
|
|
764
|
+
role: 'heading'
|
|
765
|
+
}
|
|
766
|
+
})), groupOptions && groupOptions.map(function (item) {
|
|
767
|
+
var iconName = item.iconName,
|
|
768
|
+
iconSize = item.iconSize,
|
|
769
|
+
iconClass = item.iconClass,
|
|
770
|
+
title = item.title,
|
|
771
|
+
_item$disableTitle = item.disableTitle,
|
|
772
|
+
disableTitle = _item$disableTitle === void 0 ? '' : _item$disableTitle,
|
|
773
|
+
_item$isDisabled = item.isDisabled,
|
|
774
|
+
isDisabled = _item$isDisabled === void 0 ? false : _item$isDisabled;
|
|
775
|
+
listIndex += 1;
|
|
776
|
+
return iconName ? /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], _extends({
|
|
777
|
+
key: listIndex,
|
|
778
|
+
dataId: item[keyName],
|
|
779
|
+
value: item[keyName],
|
|
780
|
+
id: item[idName],
|
|
781
|
+
active: selectedId === item[idName],
|
|
782
|
+
onClick: _this5.onSelect.bind(_this5, item),
|
|
783
|
+
index: listIndex // highlight={selectedIndex === listIndex}
|
|
784
|
+
,
|
|
785
|
+
disableTitle: disableTitle,
|
|
786
|
+
isDisabled: isDisabled,
|
|
787
|
+
iconName: iconName,
|
|
788
|
+
iconClass: iconClass,
|
|
789
|
+
iconSize: iconSize,
|
|
790
|
+
needTick: needTick,
|
|
791
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
792
|
+
,
|
|
793
|
+
getRef: _this5.itemRef,
|
|
794
|
+
title: title ? title : item[keyName],
|
|
795
|
+
palette: palette,
|
|
796
|
+
needMultiLineText: needMultiLineText,
|
|
797
|
+
autoHover: true,
|
|
798
|
+
a11y: {
|
|
799
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
800
|
+
ariaSelected: selectedId === item[idName],
|
|
801
|
+
ariaLabel: item[keyName]
|
|
802
|
+
}
|
|
803
|
+
}, ListItemWithIconProps)) : /*#__PURE__*/_react["default"].createElement(_ListItem["default"], _extends({
|
|
804
|
+
key: listIndex,
|
|
805
|
+
dataId: item[keyName],
|
|
806
|
+
value: item[keyName],
|
|
807
|
+
id: item[idName],
|
|
808
|
+
active: selectedId === item[idName],
|
|
809
|
+
onClick: _this5.onSelect.bind(_this5, item),
|
|
810
|
+
isDisabled: isDisabled,
|
|
811
|
+
disableTitle: disableTitle,
|
|
812
|
+
index: listIndex // highlight={selectedIndex === listIndex}
|
|
813
|
+
,
|
|
814
|
+
needTick: needTick,
|
|
815
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
816
|
+
,
|
|
817
|
+
getRef: _this5.itemRef,
|
|
818
|
+
title: title ? title : item[keyName],
|
|
819
|
+
palette: palette,
|
|
820
|
+
needMultiLineText: needMultiLineText,
|
|
821
|
+
autoHover: true,
|
|
822
|
+
a11y: {
|
|
823
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
824
|
+
ariaSelected: selectedId === item[idName],
|
|
825
|
+
ariaLabel: item[keyName]
|
|
826
|
+
}
|
|
827
|
+
}, ListItemProps));
|
|
828
|
+
}));
|
|
829
|
+
}), isFetchingOptions && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
830
|
+
isCover: false,
|
|
831
|
+
align: "both"
|
|
832
|
+
}, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, options.map(function (item, i) {
|
|
833
|
+
var iconName = item.iconName,
|
|
834
|
+
iconSize = item.iconSize,
|
|
835
|
+
iconClass = item.iconClass,
|
|
836
|
+
title = item.title,
|
|
837
|
+
needDivider = item.needDivider,
|
|
838
|
+
_item$isDisabled2 = item.isDisabled,
|
|
839
|
+
isDisabled = _item$isDisabled2 === void 0 ? false : _item$isDisabled2,
|
|
840
|
+
_item$disableTitle2 = item.disableTitle,
|
|
841
|
+
disableTitle = _item$disableTitle2 === void 0 ? '' : _item$disableTitle2;
|
|
842
|
+
|
|
843
|
+
if (!needDivider) {
|
|
844
|
+
listIndex += 1;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
|
|
848
|
+
key: i
|
|
849
|
+
}, needDivider ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
850
|
+
className: _ToggleDropDownModule["default"].seperatedLine
|
|
851
|
+
}) : iconName ? /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], _extends({
|
|
852
|
+
dataId: item[keyName],
|
|
853
|
+
value: item[keyName],
|
|
854
|
+
id: item[idName],
|
|
855
|
+
active: selectedId === item[idName],
|
|
856
|
+
onClick: _this5.onSelect.bind(_this5, item),
|
|
857
|
+
index: listIndex,
|
|
858
|
+
disableTitle: disableTitle,
|
|
859
|
+
isDisabled: isDisabled // highlight={selectedIndex === listIndex}
|
|
860
|
+
,
|
|
861
|
+
iconName: iconName,
|
|
862
|
+
iconClass: iconClass,
|
|
863
|
+
iconSize: iconSize,
|
|
864
|
+
needTick: needTick,
|
|
865
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
866
|
+
,
|
|
867
|
+
getRef: _this5.itemRef,
|
|
868
|
+
title: title ? title : item[keyName],
|
|
869
|
+
key: listIndex,
|
|
870
|
+
palette: palette,
|
|
871
|
+
needMultiLineText: needMultiLineText,
|
|
872
|
+
autoHover: true,
|
|
873
|
+
a11y: {
|
|
874
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
875
|
+
ariaSelected: selectedId === item[idName],
|
|
876
|
+
ariaLabel: item[keyName]
|
|
877
|
+
}
|
|
878
|
+
}, ListItemWithIconProps)) : /*#__PURE__*/_react["default"].createElement(_ListItem["default"], _extends({
|
|
879
|
+
key: listIndex,
|
|
880
|
+
dataId: item[keyName],
|
|
881
|
+
value: item[keyName],
|
|
882
|
+
id: item[idName],
|
|
883
|
+
disableTitle: disableTitle,
|
|
884
|
+
isDisabled: isDisabled,
|
|
885
|
+
active: selectedId === item[idName],
|
|
886
|
+
onClick: _this5.onSelect.bind(_this5, item),
|
|
887
|
+
index: listIndex // highlight={selectedIndex === listIndex}
|
|
888
|
+
,
|
|
889
|
+
needTick: needTick,
|
|
890
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
891
|
+
,
|
|
892
|
+
getRef: _this5.itemRef,
|
|
893
|
+
title: title ? title : item[keyName],
|
|
894
|
+
palette: palette,
|
|
895
|
+
needMultiLineText: needMultiLineText,
|
|
896
|
+
autoHover: true,
|
|
897
|
+
a11y: {
|
|
898
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
899
|
+
ariaSelected: selectedId === item[idName],
|
|
900
|
+
ariaLabel: item[keyName]
|
|
901
|
+
}
|
|
902
|
+
}, ListItemProps)));
|
|
903
|
+
}), isFetchingOptions && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
904
|
+
isCover: false,
|
|
905
|
+
align: "both"
|
|
906
|
+
}, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))) : /*#__PURE__*/_react["default"].createElement(_CommonEmptyState["default"], {
|
|
907
|
+
className: _ToggleDropDownModule["default"].svgWrapper,
|
|
908
|
+
description: searchEmptyHint,
|
|
909
|
+
title: searchErrorText || 'No results',
|
|
910
|
+
size: "small",
|
|
911
|
+
getEmptyState: _this5.emptySearchSVG
|
|
912
|
+
}) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
913
|
+
className: _ToggleDropDownModule["default"].loader
|
|
914
|
+
}, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))), getFooter ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, null, getFooter()) : null));
|
|
915
|
+
}) : null);
|
|
916
|
+
}
|
|
917
|
+
}]);
|
|
918
|
+
|
|
919
|
+
return ToggleDropDown;
|
|
920
|
+
}(_react.Component);
|
|
921
|
+
|
|
922
|
+
exports.ToggleDropDown = ToggleDropDown;
|
|
923
|
+
ToggleDropDown.defaultProps = _defaultProps.defaultProps;
|
|
924
|
+
ToggleDropDown.propTypes = _propTypes.propTypes; // if (__DOCS__) {
|
|
925
|
+
// ToggleDropDown.docs = {
|
|
926
|
+
// componentGroup: 'Molecule'
|
|
927
|
+
// };
|
|
928
|
+
// }
|
|
929
|
+
|
|
930
|
+
var _default = (0, _Popup["default"])(ToggleDropDown);
|
|
931
|
+
|
|
932
|
+
exports["default"] = _default;
|