@zohodesk/components 1.2.3 → 1.2.5
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/PropValidationExcludeFilesArray.js +10 -2
- package/.cli/propValidation_report.html +1 -1
- package/README.md +8 -0
- package/coverage/Button/Button.js.html +1 -1
- package/coverage/Button/css/Button.module.css.html +1 -1
- package/coverage/Button/css/cssJSLogic.js.html +1 -1
- package/coverage/Button/css/index.html +1 -1
- package/coverage/Button/index.html +1 -1
- package/coverage/Button/props/defaultProps.js.html +1 -1
- package/coverage/Button/props/index.html +1 -1
- package/coverage/Button/props/propTypes.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
- package/coverage/Buttongroup/index.html +1 -1
- package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
- package/coverage/Buttongroup/props/index.html +1 -1
- package/coverage/Buttongroup/props/propTypes.js.html +1 -1
- package/coverage/index.html +1 -1
- package/coverage/utils/dummyFunction.js.html +1 -1
- package/coverage/utils/index.html +1 -1
- package/es/index.js +2 -1
- package/es/v1/Accordion/Accordion.js +65 -0
- package/es/v1/Accordion/AccordionItem.js +57 -0
- package/es/v1/Accordion/index.js +2 -0
- package/es/v1/Animation/Animation.js +127 -0
- package/es/v1/AppContainer/AppContainer.js +134 -0
- package/es/v1/Avatar/Avatar.js +189 -0
- package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
- package/es/v1/Button/Button.js +68 -0
- package/es/v1/Buttongroup/Buttongroup.js +31 -0
- package/es/v1/Card/Card.js +271 -0
- package/es/v1/CheckBox/CheckBox.js +155 -0
- package/es/v1/DateTime/CalendarView.js +218 -0
- package/es/v1/DateTime/DateTime.js +783 -0
- package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
- package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
- package/es/v1/DateTime/DateWidget.js +1098 -0
- package/es/v1/DateTime/DaysRow.js +31 -0
- package/es/v1/DateTime/Time.js +166 -0
- package/es/v1/DateTime/YearView.js +264 -0
- package/es/v1/DateTime/index.js +1 -0
- package/es/v1/DropBox/DropBox.js +91 -0
- package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
- package/es/v1/DropDown/DropDown.js +73 -0
- package/es/v1/DropDown/DropDownHeading.js +44 -0
- package/es/v1/DropDown/DropDownItem.js +76 -0
- package/es/v1/DropDown/DropDownSearch.js +63 -0
- package/es/v1/DropDown/DropDownSeparator.js +15 -0
- package/es/v1/Heading/Heading.js +32 -0
- package/es/v1/Label/Label.js +40 -0
- package/es/v1/Layout/Box.js +115 -0
- package/es/v1/Layout/Container.js +132 -0
- package/es/v1/Layout/index.js +2 -0
- package/es/v1/ListItem/ListContainer.js +102 -0
- package/es/v1/ListItem/ListItem.js +124 -0
- package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
- package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
- package/es/v1/ListItem/ListItemWithIcon.js +127 -0
- package/es/v1/ListItem/ListItemWithRadio.js +105 -0
- package/es/v1/ListItem/index.js +6 -0
- package/es/v1/Modal/Modal.js +154 -0
- package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
- package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
- package/es/v1/MultiSelect/EmptyState.js +64 -0
- package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
- package/es/v1/MultiSelect/MultiSelect.js +1120 -0
- package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
- package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
- package/es/v1/MultiSelect/SelectedOptions.js +82 -0
- package/es/v1/MultiSelect/Suggestions.js +142 -0
- package/es/v1/MultiSelect/index.js +4 -0
- package/es/v1/PopOver/PopOver.js +211 -0
- package/es/v1/Popup/Popup.js +645 -0
- package/es/v1/Radio/Radio.js +115 -0
- package/es/v1/Responsive/CustomResponsive.js +195 -0
- package/es/v1/Responsive/RefWrapper.js +39 -0
- package/es/v1/Responsive/ResizeComponent.js +197 -0
- package/es/v1/Responsive/ResizeObserver.js +140 -0
- package/es/v1/Responsive/Responsive.js +194 -0
- package/es/v1/Responsive/index.js +9 -0
- package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
- package/es/v1/Ribbon/Ribbon.js +33 -0
- package/es/v1/RippleEffect/RippleEffect.js +24 -0
- package/es/v1/Select/GroupSelect.js +803 -0
- package/es/v1/Select/Select.js +969 -0
- package/es/v1/Select/SelectWithAvatar.js +344 -0
- package/es/v1/Select/SelectWithIcon.js +535 -0
- package/es/v1/Select/index.js +4 -0
- package/es/v1/Stencils/Stencils.js +26 -0
- package/es/v1/Switch/Switch.js +94 -0
- package/es/v1/Tab/Tab.js +108 -0
- package/es/v1/Tab/TabContent.js +30 -0
- package/es/v1/Tab/TabContentWrapper.js +29 -0
- package/es/v1/Tab/TabWrapper.js +57 -0
- package/es/v1/Tab/Tabs.js +612 -0
- package/es/v1/Tab/index.js +5 -0
- package/es/v1/Tag/Tag.js +134 -0
- package/es/v1/TextBox/TextBox.js +154 -0
- package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
- package/es/v1/Textarea/Textarea.js +102 -0
- package/es/v1/Tooltip/Tooltip.js +518 -0
- package/es/v1/Typography/Typography.js +38 -0
- package/es/v1/Typography/css/Typography.module.css +376 -0
- package/es/v1/Typography/css/cssJSLogic.js +46 -0
- package/es/v1/Typography/css/letterSpacingMap.js +12 -0
- package/es/v1/Typography/props/defaultProps.js +8 -0
- package/es/v1/Typography/props/propTypes.js +24 -0
- package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
- package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
- package/es/v1/semantic/Button/Button.js +53 -0
- package/es/v1/semantic/index.js +1 -0
- package/lib/index.js +10 -1
- package/lib/v1/Accordion/Accordion.js +96 -0
- package/lib/v1/Accordion/AccordionItem.js +68 -0
- package/lib/v1/Accordion/index.js +23 -0
- package/lib/v1/Animation/Animation.js +143 -0
- package/lib/v1/AppContainer/AppContainer.js +204 -0
- package/lib/v1/Avatar/Avatar.js +246 -0
- package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
- package/lib/v1/Button/Button.js +82 -0
- package/lib/v1/Buttongroup/Buttongroup.js +44 -0
- package/lib/v1/Card/Card.js +365 -0
- package/lib/v1/CheckBox/CheckBox.js +166 -0
- package/lib/v1/DateTime/CalendarView.js +285 -0
- package/lib/v1/DateTime/DateTime.js +872 -0
- package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
- package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
- package/lib/v1/DateTime/DateWidget.js +1125 -0
- package/lib/v1/DateTime/DaysRow.js +80 -0
- package/lib/v1/DateTime/Time.js +254 -0
- package/lib/v1/DateTime/YearView.js +325 -0
- package/lib/v1/DateTime/index.js +15 -0
- package/lib/v1/DropBox/DropBox.js +119 -0
- package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
- package/lib/v1/DropDown/DropDown.js +170 -0
- package/lib/v1/DropDown/DropDownHeading.js +93 -0
- package/lib/v1/DropDown/DropDownItem.js +127 -0
- package/lib/v1/DropDown/DropDownSearch.js +113 -0
- package/lib/v1/DropDown/DropDownSeparator.js +64 -0
- package/lib/v1/Heading/Heading.js +49 -0
- package/lib/v1/Label/Label.js +51 -0
- package/lib/v1/Layout/Box.js +128 -0
- package/lib/v1/Layout/Container.js +145 -0
- package/lib/v1/Layout/index.js +23 -0
- package/lib/v1/ListItem/ListContainer.js +120 -0
- package/lib/v1/ListItem/ListItem.js +138 -0
- package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
- package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
- package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
- package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
- package/lib/v1/ListItem/index.js +55 -0
- package/lib/v1/Modal/Modal.js +212 -0
- package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
- package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
- package/lib/v1/MultiSelect/EmptyState.js +112 -0
- package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
- package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
- package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
- package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
- package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
- package/lib/v1/MultiSelect/Suggestions.js +195 -0
- package/lib/v1/MultiSelect/index.js +39 -0
- package/lib/v1/PopOver/PopOver.js +293 -0
- package/lib/v1/Popup/Popup.js +715 -0
- package/lib/v1/Radio/Radio.js +126 -0
- package/lib/v1/Responsive/CustomResponsive.js +242 -0
- package/lib/v1/Responsive/RefWrapper.js +57 -0
- package/lib/v1/Responsive/ResizeComponent.js +268 -0
- package/lib/v1/Responsive/ResizeObserver.js +168 -0
- package/lib/v1/Responsive/Responsive.js +274 -0
- package/lib/v1/Responsive/index.js +55 -0
- package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
- package/lib/v1/Ribbon/Ribbon.js +44 -0
- package/lib/v1/RippleEffect/RippleEffect.js +39 -0
- package/lib/v1/Select/GroupSelect.js +877 -0
- package/lib/v1/Select/Select.js +1013 -0
- package/lib/v1/Select/SelectWithAvatar.js +394 -0
- package/lib/v1/Select/SelectWithIcon.js +597 -0
- package/lib/v1/Select/index.js +39 -0
- package/lib/v1/Stencils/Stencils.js +43 -0
- package/lib/v1/Switch/Switch.js +108 -0
- package/lib/v1/Tab/Tab.js +132 -0
- package/lib/v1/Tab/TabContent.js +42 -0
- package/lib/v1/Tab/TabContentWrapper.js +42 -0
- package/lib/v1/Tab/TabWrapper.js +89 -0
- package/lib/v1/Tab/Tabs.js +680 -0
- package/lib/v1/Tab/index.js +47 -0
- package/lib/v1/Tag/Tag.js +154 -0
- package/lib/v1/TextBox/TextBox.js +168 -0
- package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
- package/lib/v1/Textarea/Textarea.js +118 -0
- package/lib/v1/Tooltip/Tooltip.js +586 -0
- package/lib/v1/Typography/Typography.js +56 -0
- package/lib/v1/Typography/css/Typography.module.css +376 -0
- package/lib/v1/Typography/css/cssJSLogic.js +41 -0
- package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
- package/lib/v1/Typography/props/defaultProps.js +15 -0
- package/lib/v1/Typography/props/propTypes.js +35 -0
- package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
- package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
- package/lib/v1/semantic/Button/Button.js +63 -0
- package/lib/v1/semantic/index.js +15 -0
- package/package.json +4 -4
- package/result.json +1 -1
|
@@ -0,0 +1,394 @@
|
|
|
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"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _defaultProps = require("../../Select/props/defaultProps");
|
|
13
|
+
|
|
14
|
+
var _propTypes = require("../../Select/props/propTypes");
|
|
15
|
+
|
|
16
|
+
var _Select = require("./Select");
|
|
17
|
+
|
|
18
|
+
var _Popup = _interopRequireDefault(require("../Popup/Popup"));
|
|
19
|
+
|
|
20
|
+
var _Tag = _interopRequireDefault(require("../Tag/Tag"));
|
|
21
|
+
|
|
22
|
+
var _TextBox = _interopRequireDefault(require("../TextBox/TextBox"));
|
|
23
|
+
|
|
24
|
+
var _TextBoxIcon = _interopRequireDefault(require("../TextBoxIcon/TextBoxIcon"));
|
|
25
|
+
|
|
26
|
+
var _Layout = require("../Layout");
|
|
27
|
+
|
|
28
|
+
var _Card = _interopRequireWildcard(require("../Card/Card"));
|
|
29
|
+
|
|
30
|
+
var _Suggestions = _interopRequireDefault(require("../MultiSelect/Suggestions"));
|
|
31
|
+
|
|
32
|
+
var _EmptyState = _interopRequireDefault(require("../MultiSelect/EmptyState"));
|
|
33
|
+
|
|
34
|
+
var _DropDownHeading = _interopRequireDefault(require("../DropDown/DropDownHeading"));
|
|
35
|
+
|
|
36
|
+
var _IdProvider = require("../../Provider/IdProvider");
|
|
37
|
+
|
|
38
|
+
var _ResponsiveDropBox = _interopRequireDefault(require("../ResponsiveDropBox/ResponsiveDropBox"));
|
|
39
|
+
|
|
40
|
+
var _CustomResponsive = require("../Responsive/CustomResponsive");
|
|
41
|
+
|
|
42
|
+
var _Loader = _interopRequireDefault(require("@zohodesk/svg/lib/Loader/Loader"));
|
|
43
|
+
|
|
44
|
+
var _MultiSelectModule = _interopRequireDefault(require("../../MultiSelect/MultiSelect.module.css"));
|
|
45
|
+
|
|
46
|
+
var _SelectModule = _interopRequireDefault(require("../../Select/Select.module.css"));
|
|
47
|
+
|
|
48
|
+
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); }
|
|
49
|
+
|
|
50
|
+
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; }
|
|
51
|
+
|
|
52
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
53
|
+
|
|
54
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
55
|
+
|
|
56
|
+
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); } }
|
|
57
|
+
|
|
58
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
59
|
+
|
|
60
|
+
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); }
|
|
61
|
+
|
|
62
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
63
|
+
|
|
64
|
+
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); }; }
|
|
65
|
+
|
|
66
|
+
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); }
|
|
67
|
+
|
|
68
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
69
|
+
|
|
70
|
+
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; } }
|
|
71
|
+
|
|
72
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
73
|
+
|
|
74
|
+
var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
|
|
75
|
+
_inherits(SelectWithAvatarComponent, _SelectComponent);
|
|
76
|
+
|
|
77
|
+
var _super = _createSuper(SelectWithAvatarComponent);
|
|
78
|
+
|
|
79
|
+
function SelectWithAvatarComponent(props) {
|
|
80
|
+
var _this;
|
|
81
|
+
|
|
82
|
+
_classCallCheck(this, SelectWithAvatarComponent);
|
|
83
|
+
|
|
84
|
+
_this = _super.call(this, props);
|
|
85
|
+
_this.isSelectWithAvatarComponent = true;
|
|
86
|
+
_this.handleFormatOptions = _this.handleFormatOptions.bind(_assertThisInitialized(_this));
|
|
87
|
+
_this.handleActive = _this.handleActive.bind(_assertThisInitialized(_this));
|
|
88
|
+
_this.handleInactive = _this.handleInactive.bind(_assertThisInitialized(_this));
|
|
89
|
+
_this.handleSearchChange = _this.handleSearchChange.bind(_assertThisInitialized(_this));
|
|
90
|
+
_this.handleRemoveOption = _this.handleRemoveOption.bind(_assertThisInitialized(_this));
|
|
91
|
+
_this.getNextAriaId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
|
|
92
|
+
return _this;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
_createClass(SelectWithAvatarComponent, [{
|
|
96
|
+
key: "handleFormatOptions",
|
|
97
|
+
value: function handleFormatOptions(props) {
|
|
98
|
+
var options = props.options,
|
|
99
|
+
valueField = props.valueField,
|
|
100
|
+
textField = props.textField,
|
|
101
|
+
imageField = props.imageField;
|
|
102
|
+
return this.formatOptions({
|
|
103
|
+
options: options,
|
|
104
|
+
valueField: valueField,
|
|
105
|
+
textField: textField,
|
|
106
|
+
imageField: imageField,
|
|
107
|
+
optionType: 'avatar'
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "handleActive",
|
|
112
|
+
value: function handleActive(e) {
|
|
113
|
+
var isActive = this.state.isActive;
|
|
114
|
+
|
|
115
|
+
if (!isActive) {
|
|
116
|
+
this.setState({
|
|
117
|
+
isActive: true
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var _ref = e || {},
|
|
122
|
+
target = _ref.target;
|
|
123
|
+
|
|
124
|
+
target && target.setSelectionRange(target, 0);
|
|
125
|
+
var onFocus = this.props.onFocus;
|
|
126
|
+
onFocus && onFocus(this.state.searchStr);
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "handleInactive",
|
|
130
|
+
value: function handleInactive() {
|
|
131
|
+
var isActive = this.state.isActive;
|
|
132
|
+
|
|
133
|
+
if (isActive) {
|
|
134
|
+
this.setState({
|
|
135
|
+
isActive: false
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
key: "handleSearchChange",
|
|
141
|
+
value: function handleSearchChange(e) {
|
|
142
|
+
var isPopupOpen = this.props.isPopupOpen;
|
|
143
|
+
!isPopupOpen && this.togglePopup(e);
|
|
144
|
+
this.handleSearch(e);
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "handleRemoveOption",
|
|
148
|
+
value: function handleRemoveOption(e) {
|
|
149
|
+
var keyCode = e.keyCode;
|
|
150
|
+
var _this$state$searchStr = this.state.searchStr,
|
|
151
|
+
searchStr = _this$state$searchStr === void 0 ? '' : _this$state$searchStr;
|
|
152
|
+
var isDefaultSelectValue = this.props.isDefaultSelectValue;
|
|
153
|
+
|
|
154
|
+
if (keyCode === 8 && searchStr.length === 0 && !isDefaultSelectValue) {
|
|
155
|
+
this.handleChange('');
|
|
156
|
+
} else {
|
|
157
|
+
this.handleKeyDown(e);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "responsiveFunc",
|
|
162
|
+
value: function responsiveFunc(_ref2) {
|
|
163
|
+
var mediaQueryOR = _ref2.mediaQueryOR;
|
|
164
|
+
return {
|
|
165
|
+
tabletMode: mediaQueryOR([{
|
|
166
|
+
maxWidth: 700
|
|
167
|
+
}])
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "render",
|
|
172
|
+
value: function render() {
|
|
173
|
+
var _this2 = this;
|
|
174
|
+
|
|
175
|
+
var _this$props = this.props,
|
|
176
|
+
dropBoxSize = _this$props.dropBoxSize,
|
|
177
|
+
emptyMessage = _this$props.emptyMessage,
|
|
178
|
+
searchEmptyMessage = _this$props.searchEmptyMessage,
|
|
179
|
+
needBorder = _this$props.needBorder,
|
|
180
|
+
position = _this$props.position,
|
|
181
|
+
defaultDropBoxPosition = _this$props.defaultDropBoxPosition,
|
|
182
|
+
getContainerRef = _this$props.getContainerRef,
|
|
183
|
+
isPopupOpen = _this$props.isPopupOpen,
|
|
184
|
+
removeClose = _this$props.removeClose,
|
|
185
|
+
isPopupReady = _this$props.isPopupReady,
|
|
186
|
+
animationStyle = _this$props.animationStyle,
|
|
187
|
+
textBoxSize = _this$props.textBoxSize,
|
|
188
|
+
textBoxVariant = _this$props.textBoxVariant,
|
|
189
|
+
maxLength = _this$props.maxLength,
|
|
190
|
+
isDisabled = _this$props.isDisabled,
|
|
191
|
+
title = _this$props.title,
|
|
192
|
+
size = _this$props.size,
|
|
193
|
+
isReadOnly = _this$props.isReadOnly,
|
|
194
|
+
placeHolder = _this$props.placeHolder,
|
|
195
|
+
className = _this$props.className,
|
|
196
|
+
needResponsive = _this$props.needResponsive,
|
|
197
|
+
dataId = _this$props.dataId,
|
|
198
|
+
borderColor = _this$props.borderColor,
|
|
199
|
+
searchBoxPlaceHolder = _this$props.searchBoxPlaceHolder,
|
|
200
|
+
searchBoxSize = _this$props.searchBoxSize,
|
|
201
|
+
needSearch = _this$props.needSearch,
|
|
202
|
+
textBoxClass = _this$props.textBoxClass,
|
|
203
|
+
onRemove = _this$props.onRemove,
|
|
204
|
+
avatarPalette = _this$props.avatarPalette,
|
|
205
|
+
tagSize = _this$props.tagSize,
|
|
206
|
+
groupName = _this$props.groupName,
|
|
207
|
+
i18nKeys = _this$props.i18nKeys,
|
|
208
|
+
htmlId = _this$props.htmlId,
|
|
209
|
+
needEffect = _this$props.needEffect,
|
|
210
|
+
isLoading = _this$props.isLoading,
|
|
211
|
+
dataSelectorId = _this$props.dataSelectorId;
|
|
212
|
+
i18nKeys = Object.assign({}, i18nKeys, {
|
|
213
|
+
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
214
|
+
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
|
|
215
|
+
});
|
|
216
|
+
var _this$state = this.state,
|
|
217
|
+
hoverIndex = _this$state.hoverIndex,
|
|
218
|
+
searchStr = _this$state.searchStr,
|
|
219
|
+
isFetchingOptions = _this$state.isFetchingOptions,
|
|
220
|
+
selectedId = _this$state.selectedId,
|
|
221
|
+
isActive = _this$state.isActive,
|
|
222
|
+
options = _this$state.options;
|
|
223
|
+
var suggestions = this.handleFilterSuggestions();
|
|
224
|
+
|
|
225
|
+
var _ref3 = this.normalizedFormatOptions[selectedId] || {},
|
|
226
|
+
id = _ref3.id,
|
|
227
|
+
text = _ref3.value,
|
|
228
|
+
photoURL = _ref3.photoURL;
|
|
229
|
+
|
|
230
|
+
var setAriaId = this.getNextAriaId();
|
|
231
|
+
var ariaErrorId = this.getNextAriaId();
|
|
232
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
233
|
+
className: "".concat(_MultiSelectModule["default"].wrapper, " ").concat(isDisabled ? _MultiSelectModule["default"].disabled : '', " ").concat(isReadOnly ? _MultiSelectModule["default"].readOnly : '', " ").concat(needEffect && !(isDisabled || isReadOnly) ? _MultiSelectModule["default"].effect : '', " ").concat(className ? className : ''),
|
|
234
|
+
"data-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId),
|
|
235
|
+
"data-test-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId),
|
|
236
|
+
"data-title": isDisabled ? title : null,
|
|
237
|
+
"data-selector-id": dataSelectorId
|
|
238
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
239
|
+
align: "vertical",
|
|
240
|
+
alignBox: "row",
|
|
241
|
+
className: "".concat(_MultiSelectModule["default"].container, " ").concat(_MultiSelectModule["default"][size], " ").concat(_MultiSelectModule["default"]["borderColor_".concat(borderColor)], " ").concat(isActive && needBorder ? _MultiSelectModule["default"].active : '', " ").concat(textBoxClass ? textBoxClass : '', " ").concat(needBorder ? _MultiSelectModule["default"].hasBorder : ''),
|
|
242
|
+
eleRef: this.getTargetRef,
|
|
243
|
+
onClick: !isDisabled && this.togglePopup
|
|
244
|
+
}, selectedId ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
245
|
+
className: _MultiSelectModule["default"].tag,
|
|
246
|
+
"data-id": "".concat(dataId, "_SelectTag"),
|
|
247
|
+
"data-test-id": "".concat(dataId, "_SelectTag"),
|
|
248
|
+
key: "".concat(id, "tag")
|
|
249
|
+
}, /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
250
|
+
avatarPalette: avatarPalette,
|
|
251
|
+
hasAvatar: true,
|
|
252
|
+
id: id,
|
|
253
|
+
imageURL: photoURL,
|
|
254
|
+
initial: text,
|
|
255
|
+
onRemove: onRemove,
|
|
256
|
+
text: text,
|
|
257
|
+
disabled: isReadOnly || isDisabled,
|
|
258
|
+
size: tagSize
|
|
259
|
+
})) : null, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
260
|
+
flexible: true,
|
|
261
|
+
className: _MultiSelectModule["default"].textBox
|
|
262
|
+
}, /*#__PURE__*/_react["default"].createElement(_TextBox["default"], {
|
|
263
|
+
a11y: {
|
|
264
|
+
ariaActivedescendant: selectedId,
|
|
265
|
+
role: 'combobox',
|
|
266
|
+
ariaControls: setAriaId,
|
|
267
|
+
ariaOwns: setAriaId,
|
|
268
|
+
ariaExpanded: !isReadOnly && !isDisabled && isPopupOpen ? true : false,
|
|
269
|
+
ariaHaspopup: true,
|
|
270
|
+
ariaReadonly: true
|
|
271
|
+
},
|
|
272
|
+
isDisabled: isDisabled,
|
|
273
|
+
needEffect: isReadOnly || isDisabled ? false : true,
|
|
274
|
+
inputRef: this.valueInputRef,
|
|
275
|
+
maxLength: maxLength,
|
|
276
|
+
needBorder: false,
|
|
277
|
+
onBlur: this.handleInactive,
|
|
278
|
+
onChange: this.handleSearchChange,
|
|
279
|
+
onFocus: this.handleActive,
|
|
280
|
+
onKeyDown: this.handleRemoveOption,
|
|
281
|
+
onKeyPress: this.handleValueInputChange,
|
|
282
|
+
placeHolder: !selectedId ? placeHolder : '',
|
|
283
|
+
size: textBoxSize,
|
|
284
|
+
variant: textBoxVariant,
|
|
285
|
+
needReadOnlyStyle: isReadOnly ? true : false,
|
|
286
|
+
isReadOnly: true,
|
|
287
|
+
isClickable: isReadOnly || isDisabled ? false : true,
|
|
288
|
+
borderColor: borderColor,
|
|
289
|
+
htmlId: htmlId,
|
|
290
|
+
autoComplete: false
|
|
291
|
+
}))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
|
|
292
|
+
query: this.responsiveFunc,
|
|
293
|
+
responsiveId: "Helmet"
|
|
294
|
+
}, function (_ref4) {
|
|
295
|
+
var tabletMode = _ref4.tabletMode;
|
|
296
|
+
return /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], {
|
|
297
|
+
animationStyle: animationStyle,
|
|
298
|
+
boxPosition: position || "".concat(defaultDropBoxPosition, "Center"),
|
|
299
|
+
getRef: getContainerRef,
|
|
300
|
+
isActive: isPopupReady,
|
|
301
|
+
isAnimate: true,
|
|
302
|
+
isArrow: false,
|
|
303
|
+
onClick: removeClose,
|
|
304
|
+
needResponsive: needResponsive,
|
|
305
|
+
isPadding: false,
|
|
306
|
+
isResponsivePadding: true,
|
|
307
|
+
alignBox: "row"
|
|
308
|
+
}, isLoading ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
309
|
+
align: "both",
|
|
310
|
+
className: _MultiSelectModule["default"].loader
|
|
311
|
+
}, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null)) : /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
312
|
+
flexible: true
|
|
313
|
+
}, /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
314
|
+
onScroll: _this2.handleScroll
|
|
315
|
+
}, needSearch ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
316
|
+
className: "".concat(_SelectModule["default"].search, " ").concat(_SelectModule["default"][size])
|
|
317
|
+
}, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
|
|
318
|
+
inputRef: _this2.searchInputRef,
|
|
319
|
+
maxLength: maxLength,
|
|
320
|
+
onChange: _this2.handleSearch,
|
|
321
|
+
onKeyDown: _this2.handleKeyDown,
|
|
322
|
+
placeHolder: searchBoxPlaceHolder,
|
|
323
|
+
size: searchBoxSize,
|
|
324
|
+
value: searchStr,
|
|
325
|
+
onClear: _this2.handleClearSearch,
|
|
326
|
+
dataId: "".concat(dataId, "_search"),
|
|
327
|
+
a11y: {
|
|
328
|
+
ariaAutocomplete: 'list',
|
|
329
|
+
ariaControls: setAriaId,
|
|
330
|
+
ariaDescribedby: ariaErrorId
|
|
331
|
+
},
|
|
332
|
+
autoComplete: false
|
|
333
|
+
}))) : null, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
334
|
+
shrink: true,
|
|
335
|
+
customClass: !tabletMode && dropBoxSize ? _MultiSelectModule["default"][dropBoxSize] : '',
|
|
336
|
+
eleRef: _this2.suggestionContainerRef
|
|
337
|
+
}, groupName ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
338
|
+
className: _MultiSelectModule["default"].title
|
|
339
|
+
}, /*#__PURE__*/_react["default"].createElement(_DropDownHeading["default"], {
|
|
340
|
+
text: groupName,
|
|
341
|
+
a11y: {
|
|
342
|
+
role: 'heading'
|
|
343
|
+
}
|
|
344
|
+
})) : null, suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
|
|
345
|
+
activeId: selectedId,
|
|
346
|
+
suggestions: suggestions,
|
|
347
|
+
getRef: _this2.suggestionItemRef,
|
|
348
|
+
hoverOption: hoverIndex,
|
|
349
|
+
onClick: _this2.handleChange,
|
|
350
|
+
onMouseEnter: _this2.handleMouseEnter,
|
|
351
|
+
needTick: true,
|
|
352
|
+
needBorder: false,
|
|
353
|
+
selectedOptions: [selectedId],
|
|
354
|
+
className: _SelectModule["default"].listItemContainer,
|
|
355
|
+
htmlId: setAriaId,
|
|
356
|
+
a11y: {
|
|
357
|
+
ariaParentRole: 'listbox',
|
|
358
|
+
role: 'option'
|
|
359
|
+
}
|
|
360
|
+
}) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
361
|
+
isLoading: isFetchingOptions,
|
|
362
|
+
options: options,
|
|
363
|
+
searchString: searchStr,
|
|
364
|
+
suggestions: suggestions,
|
|
365
|
+
dataId: dataId,
|
|
366
|
+
i18nKeys: i18nKeys,
|
|
367
|
+
htmlId: ariaErrorId
|
|
368
|
+
}), isFetchingOptions && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
369
|
+
isCover: false,
|
|
370
|
+
align: "both"
|
|
371
|
+
}, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))))));
|
|
372
|
+
}) : null);
|
|
373
|
+
}
|
|
374
|
+
}]);
|
|
375
|
+
|
|
376
|
+
return SelectWithAvatarComponent;
|
|
377
|
+
}(_Select.SelectComponent);
|
|
378
|
+
|
|
379
|
+
SelectWithAvatarComponent.propTypes = _propTypes.SelectWithAvatar_propTypes;
|
|
380
|
+
SelectWithAvatarComponent.defaultProps = _defaultProps.SelectWithAvatar_defaultProps;
|
|
381
|
+
SelectWithAvatarComponent.displayName = 'SelectWithAvatar';
|
|
382
|
+
var SelectWithAvatar = (0, _Popup["default"])(SelectWithAvatarComponent);
|
|
383
|
+
SelectWithAvatar.defaultProps = SelectWithAvatarComponent.defaultProps;
|
|
384
|
+
SelectWithAvatar.propTypes = SelectWithAvatarComponent.propTypes; // if (__DOCS__) {
|
|
385
|
+
// SelectWithAvatar.docs = {
|
|
386
|
+
// componentGroup: 'Form Elements',
|
|
387
|
+
// folderName: 'Style Guide'
|
|
388
|
+
// };
|
|
389
|
+
// // eslint-disable-next-line react/forbid-foreign-prop-types
|
|
390
|
+
// SelectWithAvatar.propTypes = SelectWithAvatarComponent.propTypes;
|
|
391
|
+
// }
|
|
392
|
+
|
|
393
|
+
var _default = SelectWithAvatar;
|
|
394
|
+
exports["default"] = _default;
|