@zohodesk/components 1.0.0-temp-208.2 → 1.0.0-temp-210

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 (53) hide show
  1. package/README.md +7 -1
  2. package/es/Avatar/Avatar.module.css +175 -175
  3. package/es/AvatarTeam/AvatarTeam.module.css +189 -189
  4. package/es/Button/css/Button.module.css +527 -527
  5. package/es/Buttongroup/Buttongroup.module.css +104 -104
  6. package/es/CheckBox/CheckBox.module.css +157 -157
  7. package/es/DateTime/DateTime.module.css +248 -248
  8. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +431 -431
  9. package/es/DropBox/css/DropBox.module.css +58 -58
  10. package/es/DropDown/DropDownHeading.module.css +53 -53
  11. package/es/DropDown/DropDownItem.module.css +94 -94
  12. package/es/Label/Label.module.css +57 -57
  13. package/es/ListItem/ListItem.module.css +205 -205
  14. package/es/PopOver/PopOver.module.css +8 -8
  15. package/es/Popup/Popup.js +96 -8
  16. package/es/Popup/props/propTypes.js +31 -0
  17. package/es/Radio/Radio.module.css +115 -115
  18. package/es/Ribbon/Ribbon.module.css +499 -499
  19. package/es/Switch/Switch.module.css +127 -127
  20. package/es/Tag/Tag.module.css +253 -253
  21. package/es/TextBox/TextBox.module.css +196 -196
  22. package/es/TextBoxIcon/TextBoxIcon.module.css +79 -79
  23. package/es/Textarea/Textarea.module.css +140 -140
  24. package/es/common/customscroll.module.css +141 -141
  25. package/es/v1/AppContainer/AppContainer.js +6 -0
  26. package/es/v1/Popup/Popup.js +96 -8
  27. package/lib/Avatar/Avatar.module.css +175 -175
  28. package/lib/AvatarTeam/AvatarTeam.module.css +189 -189
  29. package/lib/Button/css/Button.module.css +527 -527
  30. package/lib/Buttongroup/Buttongroup.module.css +104 -104
  31. package/lib/CheckBox/CheckBox.module.css +157 -157
  32. package/lib/DateTime/DateTime.module.css +248 -248
  33. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +431 -431
  34. package/lib/DropBox/css/DropBox.module.css +58 -58
  35. package/lib/DropDown/DropDownHeading.module.css +53 -53
  36. package/lib/DropDown/DropDownItem.module.css +94 -94
  37. package/lib/Label/Label.module.css +57 -57
  38. package/lib/ListItem/ListItem.module.css +205 -205
  39. package/lib/PopOver/PopOver.module.css +8 -8
  40. package/lib/Popup/Popup.js +105 -9
  41. package/lib/Popup/props/propTypes.js +44 -0
  42. package/lib/Radio/Radio.module.css +115 -115
  43. package/lib/Ribbon/Ribbon.module.css +499 -499
  44. package/lib/Switch/Switch.module.css +127 -127
  45. package/lib/Tag/Tag.module.css +253 -253
  46. package/lib/TextBox/TextBox.module.css +196 -196
  47. package/lib/TextBoxIcon/TextBoxIcon.module.css +79 -79
  48. package/lib/Textarea/Textarea.module.css +140 -140
  49. package/lib/common/customscroll.module.css +141 -141
  50. package/lib/v1/AppContainer/AppContainer.js +12 -0
  51. package/lib/v1/Popup/Popup.js +105 -9
  52. package/package.json +1 -1
  53. package/result.json +1 -1
@@ -1,7 +1,7 @@
1
1
  /**** Libraries ****/
2
2
  import React from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import hoistStatics from 'hoist-non-react-statics';
4
+ import { PopupPropTypes, ContextTypes } from "../../Popup/props/propTypes.js";
5
5
  /**** Methods ****/
6
6
 
7
7
  import { debounce, isDescendant, isTextSelected, cancelBubblingEffect } from "../../utils/Common.js";
@@ -89,6 +89,11 @@ const Popup = function (Component) {
89
89
  this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
90
90
  this.handleDocumentFocus = this.handleDocumentFocus.bind(this);
91
91
  this.handleGetNeedPrevent = this.handleGetNeedPrevent.bind(this);
92
+ this.handleBlockScroll = this.handleBlockScroll.bind(this);
93
+ this.handlePositionChange = this.handlePositionChange.bind(this);
94
+ this.preventKeyboardScroll = this.preventKeyboardScroll.bind(this);
95
+ this.addScrollBlockListeners = this.addScrollBlockListeners.bind(this);
96
+ this.removeScrollBlockListeners = this.removeScrollBlockListeners.bind(this);
92
97
  this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
93
98
 
94
99
  this.size = null;
@@ -101,6 +106,7 @@ const Popup = function (Component) {
101
106
  scrollDebounceTime
102
107
  } = this.getScrollDebounceTime(this);
103
108
  this.handleScroll = debounce(this.handleScroll.bind(this), scrollDebounceTime);
109
+ this.handleDebouncedPositionChange = debounce(this.handlePositionChange.bind(this), 100);
104
110
  }
105
111
 
106
112
  componentDidMount() {
@@ -144,7 +150,9 @@ const Popup = function (Component) {
144
150
  dropElement
145
151
  } = this;
146
152
  const {
147
- needResizeHandling: propResizeHandling
153
+ needResizeHandling: propResizeHandling,
154
+ isAbsolutePositioningNeeded,
155
+ isBlockedOutsideScroll
148
156
  } = this.props;
149
157
 
150
158
  if (oldStateOpen !== isPopupReady) {
@@ -154,6 +162,14 @@ const Popup = function (Component) {
154
162
  this.size = null;
155
163
  this.popupObserver.disconnect();
156
164
  }
165
+
166
+ if (isBlockedOutsideScroll && !isAbsolutePositioningNeeded) {
167
+ if (isPopupReady) {
168
+ this.addScrollBlockListeners();
169
+ } else {
170
+ this.removeScrollBlockListeners();
171
+ }
172
+ }
157
173
  }
158
174
  }
159
175
 
@@ -169,6 +185,7 @@ const Popup = function (Component) {
169
185
 
170
186
  return res;
171
187
  }, popups);
188
+ this.removeScrollBlockListeners();
172
189
  let noPopups = true;
173
190
 
174
191
  for (const i in popups) {
@@ -193,6 +210,76 @@ const Popup = function (Component) {
193
210
  }
194
211
  }
195
212
 
213
+ addScrollBlockListeners() {
214
+ document.addEventListener('wheel', this.handleBlockScroll, {
215
+ capture: true,
216
+ passive: false
217
+ });
218
+ document.addEventListener('touchmove', this.handleBlockScroll, {
219
+ capture: true,
220
+ passive: false
221
+ });
222
+ document.addEventListener('scroll', this.handleDebouncedPositionChange, {
223
+ capture: true,
224
+ passive: false
225
+ });
226
+ document.addEventListener('keydown', this.preventKeyboardScroll, {
227
+ capture: true,
228
+ passive: false
229
+ });
230
+ }
231
+
232
+ removeScrollBlockListeners() {
233
+ document.removeEventListener('wheel', this.handleBlockScroll, {
234
+ capture: true,
235
+ passive: false
236
+ });
237
+ document.removeEventListener('touchmove', this.handleBlockScroll, {
238
+ capture: true,
239
+ passive: false
240
+ });
241
+ document.removeEventListener('scroll', this.handleDebouncedPositionChange, {
242
+ capture: true,
243
+ passive: false
244
+ });
245
+ document.removeEventListener('keydown', this.preventKeyboardScroll, {
246
+ capture: true,
247
+ passive: false
248
+ });
249
+ }
250
+
251
+ handleBlockScroll(event) {
252
+ // const targetElement = this.placeHolderElement;
253
+ const containerElement = this.dropElement;
254
+
255
+ if (containerElement && containerElement !== event.target && !containerElement.contains(event.target)) {
256
+ // --- Scroll exclude Target & Container elements --- For reference. Will adopt in future
257
+ // if(
258
+ // (containerElement && (containerElement !== event.target && !containerElement.contains(event.target)))
259
+ // && (targetElement && (targetElement !== event.target && !targetElement.contains(event.target)))
260
+ // ) {
261
+ event.preventDefault();
262
+ }
263
+ }
264
+
265
+ handlePositionChange(event) {
266
+ const targetElement = this.placeHolderElement;
267
+ const containerElement = this.dropElement;
268
+
269
+ if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && targetElement && targetElement !== event.target && !targetElement.contains(event.target) && event.target.contains(targetElement)) {
270
+ this.handlePopupPosition(this.state.position);
271
+ }
272
+ }
273
+
274
+ preventKeyboardScroll(event) {
275
+ const containerElement = this.dropElement;
276
+ const keys = [32, 37, 38, 39, 40]; // Space, Arrow keys
277
+
278
+ if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && keys.includes(event.keyCode)) {
279
+ event.preventDefault();
280
+ }
281
+ }
282
+
196
283
  getGroup() {
197
284
  const {
198
285
  popupGroup
@@ -523,13 +610,15 @@ const Popup = function (Component) {
523
610
  } = betterPosition || {};
524
611
  const {
525
612
  left: oldLeft = '',
526
- top: oldTop = ''
613
+ top: oldTop = '',
614
+ bottom: oldBottom = ''
527
615
  } = positionsOffset[position] || {};
528
616
  const {
529
617
  left = '',
530
- top = ''
618
+ top = '',
619
+ bottom = ''
531
620
  } = viewsOffset[view] || {};
532
- const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top; // let isInViewPort = viewPort.isInViewPort(
621
+ const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top || oldBottom !== bottom; // let isInViewPort = viewPort.isInViewPort(
533
622
  // placeHolderElement,
534
623
  // scrollContainer
535
624
  // );
@@ -635,9 +724,8 @@ const Popup = function (Component) {
635
724
  }
636
725
 
637
726
  Popup.displayName = Component.displayName || Component.name || Popup.name;
638
- Popup.contextTypes = {
639
- direction: PropTypes.string
640
- };
727
+ Popup.contextTypes = ContextTypes;
728
+ Popup.propTypes = PopupPropTypes;
641
729
  return hoistStatics(Popup, Component);
642
730
  };
643
731
 
@@ -1,176 +1,176 @@
1
- .varClass {
2
- /* avatar default variables */
3
- --avatar_text_color: var(--zdt_avatar_default_text);
4
- --avatar_font_size: var(--zd_font_size14);
5
- --avatar_bg_color: var(--zdt_avatar_default_bg);
6
- --avatar_border_radius: 50%;
7
- --avatar_border_width: 0;
8
- --avatar_border_style: solid;
9
- --avatar_border_color: var(--zdt_avatar_default_border);
10
- --avatar_border_hoverColor: var(--zdt_avatar_default_borderHover);
11
- --avatar_boxshadow: var(--zdt_avatar_default_boxshadow);
12
- --avatar_text_transform: uppercase;
13
- }
14
-
15
- .avatar {
16
- composes: varClass;
17
- position: relative;
18
- composes: dInflex alignVertical alignHorizontal from '../common/common.module.css';
19
- vertical-align: middle;
20
- font-size: var(--avatar_font_size);
21
- color: var(--avatar_text_color);
22
- border-width: var(--avatar_border_width);
23
- border-style: var(--avatar_border_style);
24
- }
25
-
26
- .border {
27
- border-color: var(--avatar_border_color);
28
- }
29
-
30
- .borderOnHover:hover, .borderOnActive {
31
- border-color: var(--avatar_border_hoverColor);
32
- }
33
-
34
- .avatar, .primary {
35
- background-color: var(--avatar_bg_color);
36
- }
37
-
38
- .shadow {
39
- position: absolute;
40
- height: 100% ;
41
- width: 100% ;
42
- top: 0 ;
43
- pointer-events: none;
44
- border-radius: var(--avatar_border_radius);
45
- }
46
-
47
- [dir=ltr] .shadow {
48
- left: 0 ;
49
- }
50
-
51
- [dir=rtl] .shadow {
52
- right: 0 ;
53
- }
54
-
55
- .shadow.black {
56
- box-shadow: var(--zd_bs_avatar_black);
57
- }
58
-
59
- .shadow.white {
60
- box-shadow: var(--zd_bs_avatar_white);
61
- }
62
-
63
- .avatar, .circle {
64
- border-radius: var(--avatar_border_radius);
65
- }
66
-
67
- .border {
68
- --avatar_border_width: 1px;
69
- }
70
-
71
- .image {
72
- width: 100% ;
73
- height: 100% ;
74
- position: absolute;
75
- top: 0 ;
76
- z-index: 0;
77
- border-radius: var(--avatar_border_radius);
78
- }
79
-
80
- [dir=ltr] .image {
81
- left: 0 ;
82
- }
83
-
84
- [dir=rtl] .image {
85
- right: 0 ;
86
- }
87
-
88
- .animate {
89
- composes: fadeIn modeForward from './../common/animation.module.css';
90
- }
91
-
92
- [dir=ltr] .animate {
93
- animation-duration: var(--zd_transition2);
94
- }
95
-
96
- [dir=rtl] .animate {
97
- animation-duration: var(--zd_transition2);
98
- }
99
-
100
- .innerBorder {
101
- border: 1px solid var(--zdt_avatarteam_innerCircle);
102
- }
103
-
104
- .square_small {
105
- --avatar_border_radius: 4px;
106
- }
107
-
108
- .square_xsmall {
109
- --avatar_border_radius: 6px;
110
- }
111
-
112
- .square_medium,
113
- .square_xmedium {
114
- --avatar_border_radius: 8px;
115
- }
116
-
117
- .square_large,
118
- .square_xlarge {
119
- --avatar_border_radius: 10px;
120
- }
121
-
122
- .none {
123
- display: none;
124
- }
125
-
126
- .default {
127
- --avatar_border_width: 0;
128
- }
129
-
130
- .secondary {
131
- --avatar_bg_color: var(--zdt_avatar_secondary_bg);
132
- }
133
-
134
- .info {
135
- --avatar_bg_color: var(--zdt_avatar_info_bg);
136
- }
137
-
138
- .initial {
139
- text-transform: var(--avatar_text_transform);
140
- display: inline-block;
141
- }
142
-
143
- .xxsmall {
144
- --avatar_font_size: var(--zd_font_size8);
145
- }
146
-
147
- .small {
148
- --avatar_font_size: var(--zd_font_size9);
149
- }
150
-
151
- .xsmall {
152
- --avatar_font_size: var(--zd_font_size12);
153
- }
154
-
155
- .medium {
156
- --avatar_font_size: var(--zd_font_size14);
157
- }
158
-
159
- .xmedium {
160
- --avatar_font_size: var(--zd_font_size14);
161
- }
162
-
163
- .large {
164
- --avatar_font_size: var(--zd_font_size18);
165
- }
166
-
167
- .xlarge {
168
- --avatar_font_size: var(--zd_font_size28);
169
- }
170
-
171
- .white {
172
- --avatar_text_color: var(--zdt_avatar_white_text);
173
- --avatar_border_color: var(--zdt_avatar_white_border);
174
- --avatar_border_hoverColor: var(--zdt_avatar_white_borderHover);
175
- --avatar_boxshadow: var(--zdt_avatar_white_boxshadow);
1
+ .varClass {
2
+ /* avatar default variables */
3
+ --avatar_text_color: var(--zdt_avatar_default_text);
4
+ --avatar_font_size: var(--zd_font_size14);
5
+ --avatar_bg_color: var(--zdt_avatar_default_bg);
6
+ --avatar_border_radius: 50%;
7
+ --avatar_border_width: 0;
8
+ --avatar_border_style: solid;
9
+ --avatar_border_color: var(--zdt_avatar_default_border);
10
+ --avatar_border_hoverColor: var(--zdt_avatar_default_borderHover);
11
+ --avatar_boxshadow: var(--zdt_avatar_default_boxshadow);
12
+ --avatar_text_transform: uppercase;
13
+ }
14
+
15
+ .avatar {
16
+ composes: varClass;
17
+ position: relative;
18
+ composes: dInflex alignVertical alignHorizontal from '../common/common.module.css';
19
+ vertical-align: middle;
20
+ font-size: var(--avatar_font_size);
21
+ color: var(--avatar_text_color);
22
+ border-width: var(--avatar_border_width);
23
+ border-style: var(--avatar_border_style);
24
+ }
25
+
26
+ .border {
27
+ border-color: var(--avatar_border_color);
28
+ }
29
+
30
+ .borderOnHover:hover, .borderOnActive {
31
+ border-color: var(--avatar_border_hoverColor);
32
+ }
33
+
34
+ .avatar, .primary {
35
+ background-color: var(--avatar_bg_color);
36
+ }
37
+
38
+ .shadow {
39
+ position: absolute;
40
+ height: 100% ;
41
+ width: 100% ;
42
+ top: 0 ;
43
+ pointer-events: none;
44
+ border-radius: var(--avatar_border_radius);
45
+ }
46
+
47
+ [dir=ltr] .shadow {
48
+ left: 0 ;
49
+ }
50
+
51
+ [dir=rtl] .shadow {
52
+ right: 0 ;
53
+ }
54
+
55
+ .shadow.black {
56
+ box-shadow: var(--zd_bs_avatar_black);
57
+ }
58
+
59
+ .shadow.white {
60
+ box-shadow: var(--zd_bs_avatar_white);
61
+ }
62
+
63
+ .avatar, .circle {
64
+ border-radius: var(--avatar_border_radius);
65
+ }
66
+
67
+ .border {
68
+ --avatar_border_width: 1px;
69
+ }
70
+
71
+ .image {
72
+ width: 100% ;
73
+ height: 100% ;
74
+ position: absolute;
75
+ top: 0 ;
76
+ z-index: 0;
77
+ border-radius: var(--avatar_border_radius);
78
+ }
79
+
80
+ [dir=ltr] .image {
81
+ left: 0 ;
82
+ }
83
+
84
+ [dir=rtl] .image {
85
+ right: 0 ;
86
+ }
87
+
88
+ .animate {
89
+ composes: fadeIn modeForward from './../common/animation.module.css';
90
+ }
91
+
92
+ [dir=ltr] .animate {
93
+ animation-duration: var(--zd_transition2);
94
+ }
95
+
96
+ [dir=rtl] .animate {
97
+ animation-duration: var(--zd_transition2);
98
+ }
99
+
100
+ .innerBorder {
101
+ border: 1px solid var(--zdt_avatarteam_innerCircle);
102
+ }
103
+
104
+ .square_small {
105
+ --avatar_border_radius: 4px;
106
+ }
107
+
108
+ .square_xsmall {
109
+ --avatar_border_radius: 6px;
110
+ }
111
+
112
+ .square_medium,
113
+ .square_xmedium {
114
+ --avatar_border_radius: 8px;
115
+ }
116
+
117
+ .square_large,
118
+ .square_xlarge {
119
+ --avatar_border_radius: 10px;
120
+ }
121
+
122
+ .none {
123
+ display: none;
124
+ }
125
+
126
+ .default {
127
+ --avatar_border_width: 0;
128
+ }
129
+
130
+ .secondary {
131
+ --avatar_bg_color: var(--zdt_avatar_secondary_bg);
132
+ }
133
+
134
+ .info {
135
+ --avatar_bg_color: var(--zdt_avatar_info_bg);
136
+ }
137
+
138
+ .initial {
139
+ text-transform: var(--avatar_text_transform);
140
+ display: inline-block;
141
+ }
142
+
143
+ .xxsmall {
144
+ --avatar_font_size: var(--zd_font_size8);
145
+ }
146
+
147
+ .small {
148
+ --avatar_font_size: var(--zd_font_size9);
149
+ }
150
+
151
+ .xsmall {
152
+ --avatar_font_size: var(--zd_font_size12);
153
+ }
154
+
155
+ .medium {
156
+ --avatar_font_size: var(--zd_font_size14);
157
+ }
158
+
159
+ .xmedium {
160
+ --avatar_font_size: var(--zd_font_size14);
161
+ }
162
+
163
+ .large {
164
+ --avatar_font_size: var(--zd_font_size18);
165
+ }
166
+
167
+ .xlarge {
168
+ --avatar_font_size: var(--zd_font_size28);
169
+ }
170
+
171
+ .white {
172
+ --avatar_text_color: var(--zdt_avatar_white_text);
173
+ --avatar_border_color: var(--zdt_avatar_white_border);
174
+ --avatar_border_hoverColor: var(--zdt_avatar_white_borderHover);
175
+ --avatar_boxshadow: var(--zdt_avatar_white_boxshadow);
176
176
  }