@zohodesk/components 1.2.4 → 1.2.6

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.
Files changed (202) hide show
  1. package/README.md +8 -0
  2. package/coverage/Button/Button.js.html +1 -1
  3. package/coverage/Button/css/Button.module.css.html +1 -1
  4. package/coverage/Button/css/cssJSLogic.js.html +1 -1
  5. package/coverage/Button/css/index.html +1 -1
  6. package/coverage/Button/index.html +1 -1
  7. package/coverage/Button/props/defaultProps.js.html +1 -1
  8. package/coverage/Button/props/index.html +1 -1
  9. package/coverage/Button/props/propTypes.js.html +1 -1
  10. package/coverage/Buttongroup/Buttongroup.js.html +1 -1
  11. package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
  12. package/coverage/Buttongroup/index.html +1 -1
  13. package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
  14. package/coverage/Buttongroup/props/index.html +1 -1
  15. package/coverage/Buttongroup/props/propTypes.js.html +1 -1
  16. package/coverage/index.html +1 -1
  17. package/coverage/utils/dummyFunction.js.html +1 -1
  18. package/coverage/utils/index.html +1 -1
  19. package/es/AppContainer/AppContainer.js +3 -0
  20. package/es/v1/Accordion/Accordion.js +65 -0
  21. package/es/v1/Accordion/AccordionItem.js +57 -0
  22. package/es/v1/Accordion/index.js +2 -0
  23. package/es/v1/Animation/Animation.js +127 -0
  24. package/es/v1/AppContainer/AppContainer.js +137 -0
  25. package/es/v1/Avatar/Avatar.js +189 -0
  26. package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
  27. package/es/v1/Button/Button.js +68 -0
  28. package/es/v1/Buttongroup/Buttongroup.js +31 -0
  29. package/es/v1/Card/Card.js +271 -0
  30. package/es/v1/CheckBox/CheckBox.js +155 -0
  31. package/es/v1/DateTime/CalendarView.js +218 -0
  32. package/es/v1/DateTime/DateTime.js +783 -0
  33. package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
  34. package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
  35. package/es/v1/DateTime/DateWidget.js +1098 -0
  36. package/es/v1/DateTime/DaysRow.js +31 -0
  37. package/es/v1/DateTime/Time.js +166 -0
  38. package/es/v1/DateTime/YearView.js +264 -0
  39. package/es/v1/DateTime/index.js +1 -0
  40. package/es/v1/DropBox/DropBox.js +91 -0
  41. package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
  42. package/es/v1/DropDown/DropDown.js +73 -0
  43. package/es/v1/DropDown/DropDownHeading.js +44 -0
  44. package/es/v1/DropDown/DropDownItem.js +76 -0
  45. package/es/v1/DropDown/DropDownSearch.js +63 -0
  46. package/es/v1/DropDown/DropDownSeparator.js +15 -0
  47. package/es/v1/Heading/Heading.js +32 -0
  48. package/es/v1/Label/Label.js +40 -0
  49. package/es/v1/Layout/Box.js +115 -0
  50. package/es/v1/Layout/Container.js +132 -0
  51. package/es/v1/Layout/index.js +2 -0
  52. package/es/v1/ListItem/ListContainer.js +102 -0
  53. package/es/v1/ListItem/ListItem.js +124 -0
  54. package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
  55. package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
  56. package/es/v1/ListItem/ListItemWithIcon.js +127 -0
  57. package/es/v1/ListItem/ListItemWithRadio.js +105 -0
  58. package/es/v1/ListItem/index.js +6 -0
  59. package/es/v1/Modal/Modal.js +154 -0
  60. package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
  61. package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
  62. package/es/v1/MultiSelect/EmptyState.js +64 -0
  63. package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
  64. package/es/v1/MultiSelect/MultiSelect.js +1120 -0
  65. package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
  66. package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
  67. package/es/v1/MultiSelect/SelectedOptions.js +82 -0
  68. package/es/v1/MultiSelect/Suggestions.js +142 -0
  69. package/es/v1/MultiSelect/index.js +4 -0
  70. package/es/v1/PopOver/PopOver.js +211 -0
  71. package/es/v1/Popup/Popup.js +645 -0
  72. package/es/v1/Radio/Radio.js +115 -0
  73. package/es/v1/Responsive/CustomResponsive.js +195 -0
  74. package/es/v1/Responsive/RefWrapper.js +39 -0
  75. package/es/v1/Responsive/ResizeComponent.js +197 -0
  76. package/es/v1/Responsive/ResizeObserver.js +140 -0
  77. package/es/v1/Responsive/Responsive.js +194 -0
  78. package/es/v1/Responsive/index.js +9 -0
  79. package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
  80. package/es/v1/Ribbon/Ribbon.js +33 -0
  81. package/es/v1/RippleEffect/RippleEffect.js +24 -0
  82. package/es/v1/Select/GroupSelect.js +803 -0
  83. package/es/v1/Select/Select.js +969 -0
  84. package/es/v1/Select/SelectWithAvatar.js +344 -0
  85. package/es/v1/Select/SelectWithIcon.js +535 -0
  86. package/es/v1/Select/index.js +4 -0
  87. package/es/v1/Stencils/Stencils.js +26 -0
  88. package/es/v1/Switch/Switch.js +94 -0
  89. package/es/v1/Tab/Tab.js +108 -0
  90. package/es/v1/Tab/TabContent.js +30 -0
  91. package/es/v1/Tab/TabContentWrapper.js +29 -0
  92. package/es/v1/Tab/TabWrapper.js +57 -0
  93. package/es/v1/Tab/Tabs.js +612 -0
  94. package/es/v1/Tab/index.js +5 -0
  95. package/es/v1/Tag/Tag.js +134 -0
  96. package/es/v1/TextBox/TextBox.js +154 -0
  97. package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
  98. package/es/v1/Textarea/Textarea.js +102 -0
  99. package/es/v1/Tooltip/Tooltip.js +518 -0
  100. package/es/v1/Typography/Typography.js +38 -0
  101. package/es/v1/Typography/css/Typography.module.css +376 -0
  102. package/es/v1/Typography/css/cssJSLogic.js +46 -0
  103. package/es/v1/Typography/css/letterSpacingMap.js +12 -0
  104. package/es/v1/Typography/props/defaultProps.js +8 -0
  105. package/es/v1/Typography/props/propTypes.js +24 -0
  106. package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
  107. package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
  108. package/es/v1/semantic/Button/Button.js +53 -0
  109. package/es/v1/semantic/index.js +1 -0
  110. package/lib/AppContainer/AppContainer.js +5 -0
  111. package/lib/v1/Accordion/Accordion.js +96 -0
  112. package/lib/v1/Accordion/AccordionItem.js +68 -0
  113. package/lib/v1/Accordion/index.js +23 -0
  114. package/lib/v1/Animation/Animation.js +143 -0
  115. package/lib/v1/AppContainer/AppContainer.js +209 -0
  116. package/lib/v1/Avatar/Avatar.js +246 -0
  117. package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
  118. package/lib/v1/Button/Button.js +82 -0
  119. package/lib/v1/Buttongroup/Buttongroup.js +44 -0
  120. package/lib/v1/Card/Card.js +365 -0
  121. package/lib/v1/CheckBox/CheckBox.js +166 -0
  122. package/lib/v1/DateTime/CalendarView.js +285 -0
  123. package/lib/v1/DateTime/DateTime.js +872 -0
  124. package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
  125. package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
  126. package/lib/v1/DateTime/DateWidget.js +1125 -0
  127. package/lib/v1/DateTime/DaysRow.js +80 -0
  128. package/lib/v1/DateTime/Time.js +254 -0
  129. package/lib/v1/DateTime/YearView.js +325 -0
  130. package/lib/v1/DateTime/index.js +15 -0
  131. package/lib/v1/DropBox/DropBox.js +119 -0
  132. package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
  133. package/lib/v1/DropDown/DropDown.js +170 -0
  134. package/lib/v1/DropDown/DropDownHeading.js +93 -0
  135. package/lib/v1/DropDown/DropDownItem.js +127 -0
  136. package/lib/v1/DropDown/DropDownSearch.js +113 -0
  137. package/lib/v1/DropDown/DropDownSeparator.js +64 -0
  138. package/lib/v1/Heading/Heading.js +49 -0
  139. package/lib/v1/Label/Label.js +51 -0
  140. package/lib/v1/Layout/Box.js +128 -0
  141. package/lib/v1/Layout/Container.js +145 -0
  142. package/lib/v1/Layout/index.js +23 -0
  143. package/lib/v1/ListItem/ListContainer.js +120 -0
  144. package/lib/v1/ListItem/ListItem.js +138 -0
  145. package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
  146. package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
  147. package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
  148. package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
  149. package/lib/v1/ListItem/index.js +55 -0
  150. package/lib/v1/Modal/Modal.js +212 -0
  151. package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
  152. package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
  153. package/lib/v1/MultiSelect/EmptyState.js +112 -0
  154. package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
  155. package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
  156. package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
  157. package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
  158. package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
  159. package/lib/v1/MultiSelect/Suggestions.js +195 -0
  160. package/lib/v1/MultiSelect/index.js +39 -0
  161. package/lib/v1/PopOver/PopOver.js +293 -0
  162. package/lib/v1/Popup/Popup.js +715 -0
  163. package/lib/v1/Radio/Radio.js +126 -0
  164. package/lib/v1/Responsive/CustomResponsive.js +242 -0
  165. package/lib/v1/Responsive/RefWrapper.js +57 -0
  166. package/lib/v1/Responsive/ResizeComponent.js +268 -0
  167. package/lib/v1/Responsive/ResizeObserver.js +168 -0
  168. package/lib/v1/Responsive/Responsive.js +274 -0
  169. package/lib/v1/Responsive/index.js +55 -0
  170. package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
  171. package/lib/v1/Ribbon/Ribbon.js +44 -0
  172. package/lib/v1/RippleEffect/RippleEffect.js +39 -0
  173. package/lib/v1/Select/GroupSelect.js +877 -0
  174. package/lib/v1/Select/Select.js +1013 -0
  175. package/lib/v1/Select/SelectWithAvatar.js +394 -0
  176. package/lib/v1/Select/SelectWithIcon.js +597 -0
  177. package/lib/v1/Select/index.js +39 -0
  178. package/lib/v1/Stencils/Stencils.js +43 -0
  179. package/lib/v1/Switch/Switch.js +108 -0
  180. package/lib/v1/Tab/Tab.js +132 -0
  181. package/lib/v1/Tab/TabContent.js +42 -0
  182. package/lib/v1/Tab/TabContentWrapper.js +42 -0
  183. package/lib/v1/Tab/TabWrapper.js +89 -0
  184. package/lib/v1/Tab/Tabs.js +680 -0
  185. package/lib/v1/Tab/index.js +47 -0
  186. package/lib/v1/Tag/Tag.js +154 -0
  187. package/lib/v1/TextBox/TextBox.js +168 -0
  188. package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
  189. package/lib/v1/Textarea/Textarea.js +118 -0
  190. package/lib/v1/Tooltip/Tooltip.js +586 -0
  191. package/lib/v1/Typography/Typography.js +56 -0
  192. package/lib/v1/Typography/css/Typography.module.css +376 -0
  193. package/lib/v1/Typography/css/cssJSLogic.js +41 -0
  194. package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
  195. package/lib/v1/Typography/props/defaultProps.js +15 -0
  196. package/lib/v1/Typography/props/propTypes.js +35 -0
  197. package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
  198. package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
  199. package/lib/v1/semantic/Button/Button.js +63 -0
  200. package/lib/v1/semantic/index.js +15 -0
  201. package/package.json +1 -1
  202. package/result.json +1 -1
@@ -0,0 +1,32 @@
1
+ /**** Libraries ****/
2
+ import React from 'react';
3
+ import { MultiSelectHeader_propTypes } from '../../MultiSelect/props/propTypes';
4
+ import { MultiSelectHeader_defaultProps } from '../../MultiSelect/props/defaultProps';
5
+ /**** Icons ****/
6
+
7
+ import ListItemWithIcon from '../ListItem/ListItemWithIcon';
8
+ /**** CSS ****/
9
+
10
+ import style from '../../MultiSelect/MultiSelect.module.css';
11
+ export default class MultiSelectHeader extends React.PureComponent {
12
+ render() {
13
+ let {
14
+ dataId,
15
+ onSelect,
16
+ selectAllText,
17
+ suggestions
18
+ } = this.props;
19
+ return /*#__PURE__*/React.createElement(React.Fragment, null, suggestions.length > 1 ? /*#__PURE__*/React.createElement(ListItemWithIcon, {
20
+ autoHover: false,
21
+ value: selectAllText,
22
+ iconName: "ZD-androidd",
23
+ iconSize: "15",
24
+ onClick: onSelect,
25
+ dataId: `${dataId}_selectAll`,
26
+ customClass: style.selectAll
27
+ }) : null);
28
+ }
29
+
30
+ }
31
+ MultiSelectHeader.propTypes = MultiSelectHeader_propTypes;
32
+ MultiSelectHeader.defaultProps = MultiSelectHeader_defaultProps;
@@ -0,0 +1,216 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ /**** Libraries ****/
4
+ import React from 'react';
5
+ import { MultiSelectWithAvatar_propTypes } from '../../MultiSelect/props/propTypes';
6
+ import { MultiSelectWithAvatar_defaultProps } from '../../MultiSelect/props/defaultProps';
7
+ /**** Components ****/
8
+
9
+ import { MultiSelectComponent } from './MultiSelect';
10
+ import Popup from '../Popup/Popup';
11
+ import { Container, Box } from '../Layout';
12
+ import Card, { CardContent, CardHeader } from '../Card/Card';
13
+ import Suggestions from './Suggestions';
14
+ import EmptyState from './EmptyState';
15
+ import MobileHeader from './MobileHeader/MobileHeader';
16
+ import MultiSelectHeader from './MultiSelectHeader';
17
+ import CssProvider from '../../Provider/CssProvider';
18
+ import { getUniqueId } from '../../Provider/IdProvider';
19
+ import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
20
+ import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
21
+ import Loader from '@zohodesk/svg/lib/Loader/Loader';
22
+ /**** Icons ****/
23
+
24
+ import { Icon } from '@zohodesk/icons';
25
+ /**** CSS ****/
26
+
27
+ import style from '../../MultiSelect/MultiSelect.module.css';
28
+ /*eslint-disable react/sort-prop-types*/
29
+
30
+ /* eslint-disable react/forbid-component-props */
31
+
32
+ /* eslint-disable react/no-unused-prop-types */
33
+
34
+ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
35
+ constructor(props) {
36
+ super(props);
37
+ this.handleFormatOptions = this.handleFormatOptions.bind(this);
38
+ this.getNextAriaId = getUniqueId(this);
39
+ }
40
+
41
+ handleFormatOptions(props) {
42
+ const {
43
+ options,
44
+ valueField,
45
+ textField,
46
+ imageField,
47
+ disabledOptions
48
+ } = props;
49
+ return this.formatOptions({
50
+ options,
51
+ valueField,
52
+ textField,
53
+ imageField,
54
+ optionType: 'avatar',
55
+ disabledOptions
56
+ });
57
+ }
58
+
59
+ responsiveFunc(_ref) {
60
+ let {
61
+ mediaQueryOR
62
+ } = _ref;
63
+ return {
64
+ tabletMode: mediaQueryOR([{
65
+ maxWidth: 700
66
+ }])
67
+ };
68
+ }
69
+
70
+ render() {
71
+ let {
72
+ isReadOnly,
73
+ needSelectAll,
74
+ searchEmptyMessage,
75
+ emptyMessage,
76
+ noMoreOptionsMessage,
77
+ dropBoxSize,
78
+ isPopupOpen,
79
+ isPopupReady,
80
+ position,
81
+ defaultDropBoxPosition,
82
+ selectAllText,
83
+ getContainerRef,
84
+ removeClose,
85
+ isAnimate,
86
+ animationStyle,
87
+ isDisabled,
88
+ title,
89
+ dataId,
90
+ dataSelectorId,
91
+ needResponsive,
92
+ borderColor,
93
+ disableAction,
94
+ palette,
95
+ i18nKeys,
96
+ isBoxPaddingNeed,
97
+ needEffect,
98
+ isLoading,
99
+ keepSelectedOptions,
100
+ customProps
101
+ } = this.props;
102
+ let {
103
+ SuggestionsProps = {}
104
+ } = customProps;
105
+ i18nKeys = Object.assign({}, MobileHeader_defaultProps.i18nKeys, i18nKeys, {
106
+ emptyText: i18nKeys.emptyText || emptyMessage,
107
+ searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
108
+ noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage
109
+ });
110
+ const {
111
+ selectedOptions,
112
+ searchStr,
113
+ hoverOption,
114
+ options,
115
+ isFetchingOptions,
116
+ selectedOptionIds
117
+ } = this.state;
118
+ const suggestions = this.handleFilterSuggestions();
119
+ const setAriaId = this.getNextAriaId();
120
+ const ariaErrorId = this.getNextAriaId();
121
+ const popUpState = !isReadOnly && !isDisabled && !disableAction && isPopupOpen;
122
+ return /*#__PURE__*/React.createElement("div", {
123
+ className: ` ${style.wrapper} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readOnly : ''} ${disableAction ? CssProvider('isBlock') : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''}`,
124
+ "data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
125
+ "data-test-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
126
+ "data-title": isDisabled ? title : null,
127
+ onClick: this.handleInputFocus,
128
+ "data-selector-id": dataSelectorId
129
+ }, this.getSelectionUI(), popUpState ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
130
+ query: this.responsiveFunc,
131
+ responsiveId: "Helmet"
132
+ }, _ref2 => {
133
+ let {
134
+ tabletMode
135
+ } = _ref2;
136
+ return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
137
+ animationStyle: animationStyle,
138
+ boxPosition: position || `${defaultDropBoxPosition}Center`,
139
+ getRef: getContainerRef,
140
+ isActive: isPopupReady,
141
+ isAnimate: isAnimate,
142
+ isArrow: false,
143
+ onClick: removeClose,
144
+ needResponsive: needResponsive,
145
+ isPadding: false,
146
+ isBoxPaddingNeed: isBoxPaddingNeed,
147
+ palette: palette,
148
+ htmlId: setAriaId,
149
+ a11y: {
150
+ ariaMultiselectable: true,
151
+ role: 'listbox'
152
+ },
153
+ isResponsivePadding: true,
154
+ alignBox: "row"
155
+ }, /*#__PURE__*/React.createElement(Box, {
156
+ flexible: true
157
+ }, /*#__PURE__*/React.createElement(Card, {
158
+ customClass: `${style.box} ${style[`${palette}Box`]}`,
159
+ onScroll: this.handleScroll
160
+ }, tabletMode && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MobileHeader, {
161
+ selectedOptions: selectedOptions,
162
+ i18nKeys: i18nKeys,
163
+ onClick: this.handlePopupClose
164
+ }, /*#__PURE__*/React.createElement("div", {
165
+ className: style.effect
166
+ }, this.getSelectionUI(true)))), needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
167
+ onSelect: this.handleSelectAll,
168
+ selectAllText: selectAllText,
169
+ suggestions: suggestions,
170
+ dataId: dataId
171
+ })) : null, isLoading ? /*#__PURE__*/React.createElement(Container, {
172
+ align: "both",
173
+ className: style.loader
174
+ }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(CardContent, {
175
+ shrink: true,
176
+ customClass: !tabletMode && dropBoxSize ? style[dropBoxSize] : '',
177
+ eleRef: this.suggestionContainerRef
178
+ }, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, _extends({
179
+ needTick: keepSelectedOptions,
180
+ suggestions: suggestions,
181
+ getRef: this.suggestionItemRef,
182
+ hoverOption: hoverOption,
183
+ onClick: this.handleSelectOption,
184
+ onMouseEnter: this.handleMouseEnter,
185
+ needBorder: false,
186
+ dataId: `${dataId}_Options`,
187
+ palette: palette,
188
+ selectedOptions: selectedOptionIds,
189
+ a11y: {
190
+ role: 'option'
191
+ }
192
+ }, SuggestionsProps)) : /*#__PURE__*/React.createElement(EmptyState, {
193
+ isLoading: isFetchingOptions,
194
+ options: options,
195
+ searchString: searchStr,
196
+ suggestions: suggestions,
197
+ dataId: dataId,
198
+ palette: palette,
199
+ i18nKeys: i18nKeys,
200
+ htmlId: ariaErrorId
201
+ }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
202
+ isCover: false,
203
+ align: "both"
204
+ }, /*#__PURE__*/React.createElement(Loader, null))))));
205
+ }) : null);
206
+ }
207
+
208
+ }
209
+
210
+ MultiSelectWithAvatarComponent.propTypes = MultiSelectWithAvatar_propTypes;
211
+ MultiSelectWithAvatarComponent.defaultProps = MultiSelectWithAvatar_defaultProps;
212
+ MultiSelectWithAvatarComponent.displayName = 'MultiSelectWithAvatar';
213
+ const MultiSelectWithAvatar = Popup(MultiSelectWithAvatarComponent);
214
+ MultiSelectWithAvatar.defaultProps = MultiSelectWithAvatarComponent.defaultProps;
215
+ MultiSelectWithAvatar.propTypes = MultiSelectWithAvatarComponent.propTypes;
216
+ export default MultiSelectWithAvatar;
@@ -0,0 +1,82 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ /**** Libraries ****/
4
+ import React from 'react';
5
+ import { SelectedOptions_propTypes } from '../../MultiSelect/props/propTypes';
6
+ import { SelectedOptions_defaultProps } from '../../MultiSelect/props/defaultProps';
7
+ /**** Components ****/
8
+
9
+ import Tag from '../Tag/Tag';
10
+ import { Box } from '../Layout';
11
+ /**** Style ****/
12
+
13
+ import style from '../../MultiSelect/SelectedOptions.module.css';
14
+ /* eslint-disable react/forbid-component-props */
15
+
16
+ export default class SelectedOptions extends React.PureComponent {
17
+ render() {
18
+ const {
19
+ selectedOptions,
20
+ highLightedSelectOptions,
21
+ isReadOnly,
22
+ getRef,
23
+ onRemove,
24
+ onSelect,
25
+ size,
26
+ palette
27
+ } = this.props;
28
+ const isDarkPalette = palette === 'dark' ? 'dark' : 'danger';
29
+ return /*#__PURE__*/React.createElement(React.Fragment, null, selectedOptions.map(option => {
30
+ const {
31
+ id,
32
+ value,
33
+ photoURL,
34
+ icon,
35
+ optionType,
36
+ iconSize,
37
+ isDisabled
38
+ } = option;
39
+ const commonProps = {
40
+ disabled: isDisabled,
41
+ onRemove: isDisabled || isReadOnly ? null : onRemove,
42
+ text: value,
43
+ palette: isDarkPalette,
44
+ onSelectTag: isReadOnly ? null : onSelect,
45
+ getRef: getRef,
46
+ initial: value,
47
+ id: id,
48
+ isReadOnly: isReadOnly
49
+ };
50
+
51
+ if (optionType === 'avatar') {
52
+ return /*#__PURE__*/React.createElement(Box, {
53
+ className: `${style.tag} ${style[size]}`,
54
+ key: `${id}photoTag`
55
+ }, /*#__PURE__*/React.createElement(Tag, _extends({}, commonProps, {
56
+ active: highLightedSelectOptions.indexOf(id) >= 0,
57
+ hasAvatar: true,
58
+ imageURL: photoURL
59
+ })));
60
+ } else if (optionType === 'icon') {
61
+ return /*#__PURE__*/React.createElement(Box, {
62
+ className: `${style.tag} ${style[size]}`,
63
+ key: `${id}iconTag`
64
+ }, /*#__PURE__*/React.createElement(Tag, _extends({}, commonProps, {
65
+ active: highLightedSelectOptions.indexOf(id) >= 0,
66
+ iconName: icon,
67
+ iconSize: iconSize
68
+ })));
69
+ }
70
+
71
+ return /*#__PURE__*/React.createElement(Box, {
72
+ className: `${style.tag} ${style[size]}`,
73
+ key: `${id}tag`
74
+ }, /*#__PURE__*/React.createElement(Tag, _extends({}, commonProps, {
75
+ active: highLightedSelectOptions.indexOf(id) >= 0
76
+ })));
77
+ }));
78
+ }
79
+
80
+ }
81
+ SelectedOptions.propTypes = SelectedOptions_propTypes;
82
+ SelectedOptions.defaultProps = SelectedOptions_defaultProps;
@@ -0,0 +1,142 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ /**** Libraries ****/
4
+ import React from 'react';
5
+ import { Suggestions_propTypes } from '../../MultiSelect/props/propTypes';
6
+ import { Suggestions_defaultProps } from '../../MultiSelect/props/defaultProps';
7
+ /**** Components ****/
8
+
9
+ import ListItem from '../ListItem/ListItem';
10
+ import ListItemWithAvatar from '../ListItem/ListItemWithAvatar';
11
+ import ListItemWithIcon from '../ListItem/ListItemWithIcon';
12
+ import { Container, Box } from '../Layout';
13
+ export default class Suggestions extends React.PureComponent {
14
+ render() {
15
+ const {
16
+ suggestions,
17
+ getRef,
18
+ hoverOption,
19
+ onClick,
20
+ onMouseEnter,
21
+ needTick,
22
+ needBorder,
23
+ selectedOptions = [],
24
+ activeId,
25
+ hoverId,
26
+ dataId,
27
+ listItemSize,
28
+ className,
29
+ avatarPalette,
30
+ palette,
31
+ htmlId,
32
+ a11y
33
+ } = this.props;
34
+ const {
35
+ ariaParentRole,
36
+ ariaMultiselectable
37
+ } = a11y;
38
+ return /*#__PURE__*/React.createElement(Container, {
39
+ isCover: false,
40
+ role: ariaParentRole,
41
+ id: htmlId,
42
+ tabindex: "0",
43
+ "aria-multiselectable": ariaMultiselectable
44
+ }, /*#__PURE__*/React.createElement(Box, {
45
+ dataId: `${dataId}`,
46
+ className: className ? className : ''
47
+ }, suggestions.map((suggestion, index) => {
48
+ const {
49
+ id,
50
+ value,
51
+ photoURL,
52
+ icon,
53
+ optionType,
54
+ iconSize,
55
+ isDisabled,
56
+ listItemProps,
57
+ listItemCustomProps = {}
58
+ } = suggestion;
59
+ const isActive = activeId === id || selectedOptions.indexOf(id) >= 0;
60
+ const isHighlight = hoverOption === index || id === hoverId ? true : false;
61
+ const list_a11y = Object.assign({}, a11y, {
62
+ ariaSelected: isActive,
63
+ ariaLabel: value
64
+ });
65
+ const commonProps = {
66
+ isDisabled,
67
+ ...listItemCustomProps
68
+ };
69
+
70
+ if (listItemProps) {
71
+ commonProps.customProps = {
72
+ ListItemProps: { ...listItemProps
73
+ }
74
+ };
75
+ }
76
+
77
+ if (optionType === 'avatar') {
78
+ return /*#__PURE__*/React.createElement(ListItemWithAvatar, _extends({}, commonProps, {
79
+ autoHover: false,
80
+ getRef: getRef,
81
+ highlight: isHighlight,
82
+ id: id,
83
+ imgSrc: photoURL,
84
+ key: `${id}avatarListItem`,
85
+ name: value,
86
+ onClick: onClick,
87
+ onMouseEnter: onMouseEnter,
88
+ value: value,
89
+ title: value,
90
+ needTick: needTick,
91
+ needBorder: needBorder,
92
+ active: isActive,
93
+ size: listItemSize,
94
+ avatarPalette: avatarPalette,
95
+ palette: palette,
96
+ a11y: list_a11y
97
+ }));
98
+ } else if (optionType === 'icon') {
99
+ return /*#__PURE__*/React.createElement(ListItemWithIcon, _extends({}, commonProps, {
100
+ autoHover: false,
101
+ getRef: getRef,
102
+ highlight: isHighlight,
103
+ id: id,
104
+ key: `${id}iconListItem`,
105
+ onClick: onClick,
106
+ onMouseEnter: onMouseEnter,
107
+ value: value,
108
+ title: value,
109
+ iconName: icon,
110
+ needTick: needTick,
111
+ needBorder: needBorder,
112
+ active: isActive,
113
+ iconSize: iconSize,
114
+ size: listItemSize,
115
+ palette: palette,
116
+ a11y: list_a11y
117
+ }));
118
+ }
119
+
120
+ return /*#__PURE__*/React.createElement(ListItem, _extends({}, commonProps, {
121
+ autoHover: false,
122
+ getRef: getRef,
123
+ highlight: isHighlight,
124
+ id: id,
125
+ key: `${id}listItem`,
126
+ onClick: onClick,
127
+ onMouseEnter: onMouseEnter,
128
+ value: value,
129
+ title: value,
130
+ needTick: needTick,
131
+ needBorder: needBorder,
132
+ active: isActive,
133
+ size: listItemSize,
134
+ palette: palette,
135
+ a11y: list_a11y
136
+ }));
137
+ })));
138
+ }
139
+
140
+ }
141
+ Suggestions.propTypes = Suggestions_propTypes;
142
+ Suggestions.defaultProps = Suggestions_defaultProps;
@@ -0,0 +1,4 @@
1
+ export { default as MultiSelect } from './MultiSelect';
2
+ export { default as MultiSelectWithAvatar } from './MultiSelectWithAvatar';
3
+ export { default as AdvancedMultiSelect } from './AdvancedMultiSelect';
4
+ export { default as AdvancedGroupMultiSelect } from './AdvancedGroupMultiSelect';
@@ -0,0 +1,211 @@
1
+ import React from 'react';
2
+ import { PopOver_defaultProps, PopOverContainer_defaultProps } from '../../PopOver/props/defaultProps';
3
+ import { PopOver_propTypes, PopOverTarget_propTypes, PopOverContainer_propTypes } from '../../PopOver/props/propTypes';
4
+ import Popup from '../Popup/Popup';
5
+ import { Box } from '../Layout';
6
+ import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
7
+ import style from '../../PopOver/PopOver.module.css';
8
+
9
+ class PopOver extends React.Component {
10
+ constructor(props) {
11
+ super(props);
12
+ this.popOverTargetRef = this.popOverTargetRef.bind(this);
13
+ this.popOverContainerRef = this.popOverContainerRef.bind(this);
14
+ this.togglePopup = this.togglePopup.bind(this);
15
+ }
16
+
17
+ componentDidUpdate(prevProps) {
18
+ let {
19
+ isPopupOpen,
20
+ onPopupOpen,
21
+ onPopupClose
22
+ } = this.props;
23
+
24
+ if (prevProps.isPopupOpen !== isPopupOpen) {
25
+ isPopupOpen && onPopupOpen && onPopupOpen();
26
+ !isPopupOpen && onPopupClose && onPopupClose();
27
+ }
28
+ }
29
+
30
+ popOverTargetRef(el) {
31
+ this.popOverTarget = el;
32
+ let {
33
+ getTargetRef
34
+ } = this.props;
35
+ getTargetRef(el);
36
+ }
37
+
38
+ popOverContainerRef(el) {
39
+ this.popOverContainer = el;
40
+ let {
41
+ getContainerRef
42
+ } = this.props;
43
+ getContainerRef(el);
44
+ }
45
+
46
+ togglePopup(e) {
47
+ let {
48
+ togglePopup,
49
+ boxPosition
50
+ } = this.props;
51
+ togglePopup(e, boxPosition);
52
+ }
53
+
54
+ render() {
55
+ let {
56
+ children,
57
+ isPopupOpen,
58
+ removeClose,
59
+ right,
60
+ left,
61
+ top,
62
+ bottom,
63
+ arrowRight,
64
+ arrowLeft,
65
+ arrowTop,
66
+ arrowBottom,
67
+ isAnimate,
68
+ isArrow,
69
+ arrowPosition,
70
+ position,
71
+ size,
72
+ onClick,
73
+ isPopupReady
74
+ } = this.props;
75
+ let childrens = React.Children.map(children, (child, index) => {
76
+ let element = index === 1 ? /*#__PURE__*/React.cloneElement(child, {
77
+ isPopupOpen,
78
+ togglePopup: this.togglePopup,
79
+ removeClose,
80
+ right,
81
+ left,
82
+ top,
83
+ bottom,
84
+ arrowRight,
85
+ arrowLeft,
86
+ arrowTop,
87
+ arrowBottom,
88
+ boxPosition: position,
89
+ isAnimate,
90
+ isArrow,
91
+ arrowPosition,
92
+ size,
93
+ onClick,
94
+ getRef: this.popOverContainerRef,
95
+ isPopupReady
96
+ }) : /*#__PURE__*/React.cloneElement(child, {
97
+ isPopupOpen,
98
+ togglePopup: this.togglePopup,
99
+ removeClose,
100
+ getRef: this.popOverTargetRef
101
+ });
102
+ return element;
103
+ });
104
+ return /*#__PURE__*/React.createElement("div", {
105
+ className: style.popup
106
+ }, childrens);
107
+ }
108
+
109
+ }
110
+
111
+ PopOver.defaultProps = PopOver_defaultProps;
112
+ PopOver.propTypes = PopOver_propTypes;
113
+ export default Popup(PopOver);
114
+ export class PopOverTarget extends React.Component {
115
+ constructor(props) {
116
+ super(props);
117
+ this.getRef = this.getRef.bind(this);
118
+ }
119
+
120
+ getRef(el) {
121
+ let {
122
+ getRef
123
+ } = this.props;
124
+ getRef(el);
125
+ }
126
+
127
+ render() {
128
+ let {
129
+ children,
130
+ togglePopup
131
+ } = this.props;
132
+ return /*#__PURE__*/React.createElement("div", {
133
+ className: style.target,
134
+ onClick: togglePopup,
135
+ ref: this.getRef
136
+ }, children);
137
+ }
138
+
139
+ }
140
+ PopOverTarget.propTypes = PopOverTarget_propTypes;
141
+ export class PopOverContainer extends React.Component {
142
+ constructor(props) {
143
+ super(props);
144
+ this.handleClick = this.handleClick.bind(this);
145
+ this.getRef = this.getRef.bind(this);
146
+ }
147
+
148
+ getRef(el) {
149
+ let {
150
+ getRef
151
+ } = this.props;
152
+ getRef && getRef(el);
153
+ }
154
+
155
+ handleClick(e) {
156
+ let {
157
+ onClick,
158
+ removeClose
159
+ } = this.props;
160
+ removeClose && removeClose(e);
161
+ onClick && onClick();
162
+ }
163
+
164
+ render() {
165
+ let {
166
+ children,
167
+ isPopupOpen,
168
+ isAnimate,
169
+ isArrow,
170
+ size,
171
+ arrowPosition,
172
+ boxPosition,
173
+ right,
174
+ left,
175
+ top,
176
+ bottom,
177
+ arrowRight,
178
+ arrowLeft,
179
+ arrowTop,
180
+ arrowBottom,
181
+ animationStyle,
182
+ getRef
183
+ } = this.props;
184
+ return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
185
+ animationStyle: animationStyle,
186
+ arrowBottom: arrowBottom,
187
+ arrowLeft: arrowLeft,
188
+ arrowPosition: arrowPosition,
189
+ arrowRight: arrowRight,
190
+ arrowTop: arrowTop,
191
+ bottom: bottom,
192
+ boxPosition: boxPosition,
193
+ getRef: getRef,
194
+ isActive: isPopupOpen,
195
+ isAnimate: isAnimate,
196
+ isArrow: isArrow,
197
+ left: left,
198
+ right: right,
199
+ size: size,
200
+ top: top,
201
+ alignBox: "row"
202
+ }, /*#__PURE__*/React.createElement(Box, {
203
+ flexible: true,
204
+ shrink: true,
205
+ scroll: "vertical"
206
+ }, children));
207
+ }
208
+
209
+ }
210
+ PopOverContainer.defaultProps = PopOverContainer_defaultProps;
211
+ PopOverContainer.propTypes = PopOverContainer_propTypes;