@zohodesk/components 1.2.50 → 1.2.52

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/README.md CHANGED
@@ -32,6 +32,13 @@ In this Package, we Provide Some Basic Components to Build Web App
32
32
  - TextBoxIcon
33
33
  - Tooltip
34
34
 
35
+ # 1.2.52
36
+
37
+ - **Typography** - component added in v0
38
+
39
+ # 1.2.51
40
+
41
+ - **Popup** - Fixed issue: Error on unmount when target ref is not available.
35
42
 
36
43
  # 1.2.50
37
44
 
package/es/Popup/Popup.js CHANGED
@@ -95,6 +95,8 @@ const Popup = function (Component) {
95
95
  this.preventKeyboardScroll = this.preventKeyboardScroll.bind(this);
96
96
  this.addScrollBlockListeners = this.addScrollBlockListeners.bind(this);
97
97
  this.removeScrollBlockListeners = this.removeScrollBlockListeners.bind(this);
98
+ this.handleAddingScrollBlock = this.handleAddingScrollBlock.bind(this);
99
+ this.handleRemovingScrollBlock = this.handleRemovingScrollBlock.bind(this);
98
100
  this.handleIntersectionObserver = this.handleIntersectionObserver.bind(this);
99
101
  this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
100
102
 
@@ -152,9 +154,7 @@ const Popup = function (Component) {
152
154
  dropElement
153
155
  } = this;
154
156
  const {
155
- needResizeHandling: propResizeHandling,
156
- isAbsolutePositioningNeeded,
157
- isOutsideScrollBlocked
157
+ needResizeHandling: propResizeHandling
158
158
  } = this.props;
159
159
 
160
160
  if (oldStateOpen !== isPopupReady) {
@@ -165,14 +165,10 @@ const Popup = function (Component) {
165
165
  this.popupObserver.disconnect();
166
166
  }
167
167
 
168
- if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
169
- if (isPopupReady) {
170
- addIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
171
- this.addScrollBlockListeners();
172
- } else {
173
- removeIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
174
- this.removeScrollBlockListeners();
175
- }
168
+ if (isPopupReady) {
169
+ this.handleAddingScrollBlock();
170
+ } else {
171
+ this.handleRemovingScrollBlock();
176
172
  }
177
173
  }
178
174
  }
@@ -189,8 +185,7 @@ const Popup = function (Component) {
189
185
 
190
186
  return res;
191
187
  }, popups);
192
- removeIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
193
- this.removeScrollBlockListeners();
188
+ this.handleRemovingScrollBlock();
194
189
  let noPopups = true;
195
190
 
196
191
  for (const i in popups) {
@@ -215,6 +210,30 @@ const Popup = function (Component) {
215
210
  }
216
211
  }
217
212
 
213
+ handleAddingScrollBlock() {
214
+ const {
215
+ isAbsolutePositioningNeeded,
216
+ isOutsideScrollBlocked
217
+ } = this.props;
218
+
219
+ if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
220
+ addIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
221
+ this.addScrollBlockListeners();
222
+ }
223
+ }
224
+
225
+ handleRemovingScrollBlock() {
226
+ const {
227
+ isAbsolutePositioningNeeded,
228
+ isOutsideScrollBlocked
229
+ } = this.props;
230
+
231
+ if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
232
+ removeIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
233
+ this.removeScrollBlockListeners();
234
+ }
235
+ }
236
+
218
237
  addScrollBlockListeners() {
219
238
  document.addEventListener('wheel', this.handleBlockScroll, {
220
239
  capture: true,
@@ -2,38 +2,48 @@ let observerCallbacks = null;
2
2
  let intersectionObserver = null;
3
3
 
4
4
  function handleObserverCallbacks(entries) {
5
- entries.map((entry, i) => {
5
+ entries.forEach(entry => {
6
6
  let oldCallbacks = observerCallbacks.get(entry.target);
7
- oldCallbacks.length && oldCallbacks.forEach(callback => {
8
- callback && callback(entry);
9
- });
7
+
8
+ if (Array.isArray(oldCallbacks) && oldCallbacks.length) {
9
+ oldCallbacks.forEach(callback => {
10
+ callback && callback(entry);
11
+ });
12
+ }
10
13
  });
11
14
  }
12
15
 
13
16
  export function addIntersectionObserver(element, callback, options) {
14
- if (intersectionObserver === null && observerCallbacks === null) {
15
- intersectionObserver = new IntersectionObserver(entries => {
16
- handleObserverCallbacks(entries);
17
- }, options);
18
- observerCallbacks = new Map();
19
- }
17
+ if (!!element && typeof callback == 'function') {
18
+ if (intersectionObserver === null && observerCallbacks === null) {
19
+ intersectionObserver = new IntersectionObserver(entries => {
20
+ handleObserverCallbacks(entries);
21
+ }, options);
22
+ observerCallbacks = new Map();
23
+ }
20
24
 
21
- intersectionObserver.observe(element);
22
- let oldCallbacks = observerCallbacks.get(element) || [];
23
- observerCallbacks.set(element, [...oldCallbacks, callback]);
25
+ intersectionObserver.observe(element);
26
+ let oldCallbacks = observerCallbacks.get(element) || [];
27
+ observerCallbacks.set(element, [...oldCallbacks, callback]);
28
+ }
24
29
  }
25
30
  export function removeIntersectionObserver(element, callback) {
26
- let oldCallbacks = observerCallbacks ? observerCallbacks.get(element) : [];
27
- oldCallbacks = oldCallbacks.filter(handler => handler !== callback);
31
+ if (!!element && typeof callback == 'function') {
32
+ let oldCallbacks = observerCallbacks ? observerCallbacks.get(element) : null;
28
33
 
29
- if (intersectionObserver && oldCallbacks.length === 0) {
30
- observerCallbacks.delete(element);
31
- intersectionObserver.unobserve(element);
32
- }
34
+ if (Array.isArray(oldCallbacks)) {
35
+ let callbacks = oldCallbacks.filter(handler => handler !== callback);
36
+
37
+ if (intersectionObserver && callbacks.length === 0) {
38
+ observerCallbacks.delete(element);
39
+ intersectionObserver.unobserve(element);
40
+ }
41
+ }
33
42
 
34
- if (intersectionObserver && observerCallbacks && observerCallbacks.size === 0) {
35
- intersectionObserver.disconnect();
36
- intersectionObserver = null;
37
- observerCallbacks = null;
43
+ if (intersectionObserver && observerCallbacks && observerCallbacks.size === 0) {
44
+ intersectionObserver.disconnect();
45
+ intersectionObserver = null;
46
+ observerCallbacks = null;
47
+ }
38
48
  }
39
49
  }
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import { defaultProps } from "./props/defaultProps";
3
+ import { propTypes } from "./props/propTypes";
4
+ import cssJSLogic from "./css/cssJSLogic";
5
+ import { mergeStyle } from '@zohodesk/utils';
6
+ import defaultStyle from "./css/Typography.module.css";
7
+
8
+ const Typography = props => {
9
+ const {
10
+ children,
11
+ $ui_tagName,
12
+ $i18n_dataTitle,
13
+ testId,
14
+ customId,
15
+ $tagAttributes_text,
16
+ $a11yAttributes_text,
17
+ customStyle
18
+ } = props;
19
+ const style = mergeStyle(defaultStyle, customStyle);
20
+ const {
21
+ typographyClass
22
+ } = cssJSLogic({
23
+ props,
24
+ style
25
+ });
26
+ return /*#__PURE__*/React.createElement($ui_tagName, {
27
+ className: typographyClass,
28
+ 'data-title': $i18n_dataTitle,
29
+ 'data-id': customId,
30
+ 'data-test-id': testId,
31
+ ...$tagAttributes_text,
32
+ ...$a11yAttributes_text
33
+ }, children);
34
+ };
35
+
36
+ Typography.propTypes = propTypes;
37
+ Typography.defaultProps = defaultProps;
38
+ export default Typography;
@@ -0,0 +1,489 @@
1
+ .reset {
2
+ font-weight: initial;
3
+ margin: initial ;
4
+ padding: initial ;
5
+ }
6
+
7
+ .dotted {
8
+ composes: dotted from '../../common/common.module.css';
9
+ }
10
+
11
+ .display_block {
12
+ display: block;
13
+ }
14
+
15
+ .display_inlineBlock {
16
+ display: inline-block;
17
+ }
18
+
19
+ .display_inline {
20
+ display: inline;
21
+ }
22
+
23
+ .display_initial {
24
+ display: initial;
25
+ }
26
+
27
+ .font_regular {
28
+ font-family: var(--zd_regular);
29
+ }
30
+
31
+ .font_light {
32
+ font-family: var(--zd_light);
33
+ }
34
+
35
+ .font_semibold {
36
+ font-family: var(--zd_semibold);
37
+ composes: ftsmooth from '../../common/common.module.css';
38
+ }
39
+
40
+ .font_bold {
41
+ font-family: var(--zd_bold);
42
+ composes: ftsmooth from '../../common/common.module.css';
43
+ }
44
+
45
+ .fontStyles_normal {
46
+ font-style: normal;
47
+ }
48
+
49
+ .fontStyles_italic {
50
+ font-style: italic;
51
+ }
52
+
53
+ .decoration_default {
54
+ text-decoration: none;
55
+ }
56
+
57
+ .decoration_underline {
58
+ text-decoration: underline;
59
+ }
60
+
61
+ .decoration_strike {
62
+ text-decoration: line-through;
63
+ }
64
+
65
+ .decoration_overline {
66
+ text-decoration: overline;
67
+ }
68
+
69
+ [dir=ltr] .textalign_left {
70
+ text-align: left;
71
+ }
72
+
73
+ [dir=rtl] .textalign_left {
74
+ text-align: right;
75
+ }
76
+
77
+ [dir=ltr] .textalign_right {
78
+ text-align: right;
79
+ }
80
+
81
+ [dir=rtl] .textalign_right {
82
+ text-align: left;
83
+ }
84
+
85
+ .textalign_center {
86
+ text-align: center;
87
+ }
88
+
89
+ .textalign_justify {
90
+ text-align: justify;
91
+ }
92
+
93
+ .transform_default {
94
+ text-transform: none;
95
+ }
96
+
97
+ .transform_upper {
98
+ text-transform: uppercase;
99
+ }
100
+
101
+ .transform_lower {
102
+ text-transform: lowercase;
103
+ }
104
+
105
+ .transform_capital {
106
+ text-transform: capitalize;
107
+ }
108
+
109
+ .dotted_clamp {
110
+ display: -webkit-box;
111
+ -webkit-box-orient: vertical;
112
+ overflow: hidden;
113
+ }
114
+
115
+ .lineclamp_1 {
116
+ -webkit-line-clamp: 1;
117
+ composes: dotted_clamp;
118
+ }
119
+
120
+ .lineclamp_2 {
121
+ -webkit-line-clamp: 2;
122
+ composes: dotted_clamp;
123
+ }
124
+
125
+ .lineclamp_3 {
126
+ -webkit-line-clamp: 3;
127
+ composes: dotted_clamp;
128
+ }
129
+
130
+ .lineclamp_4 {
131
+ -webkit-line-clamp: 4;
132
+ composes: dotted_clamp;
133
+ }
134
+
135
+ .lineclamp_5 {
136
+ -webkit-line-clamp: 5;
137
+ composes: dotted_clamp;
138
+ }
139
+
140
+ .wordBreak_breakAll {
141
+ word-break: break-all
142
+ }
143
+
144
+ .wordBreak_keepAll {
145
+ word-break: keep-all
146
+ }
147
+
148
+ .wordBreak_breakWord {
149
+ word-break: break-word
150
+ }
151
+
152
+ .wordWrap_normal {
153
+ word-wrap: normal;
154
+ }
155
+
156
+ .wordWrap_break {
157
+ word-wrap: break-word
158
+ }
159
+
160
+ .whiteSpace_normal {
161
+ white-space: normal
162
+ }
163
+
164
+ .whiteSpace_noWrap {
165
+ white-space: nowrap
166
+ }
167
+
168
+ .whiteSpace_pre {
169
+ white-space: pre
170
+ }
171
+
172
+ .whiteSpace_preLine {
173
+ white-space: pre-line
174
+ }
175
+
176
+ .whiteSpace_preWrap {
177
+ white-space: pre-wrap
178
+ }
179
+
180
+
181
+
182
+ /*...............Font Size Start.........*/
183
+
184
+ .size7 {
185
+ font-size: var(--zd_font_size7) ;
186
+ }
187
+
188
+ .size8 {
189
+ font-size: var(--zd_font_size8) ;
190
+ }
191
+
192
+ .size9 {
193
+ font-size: var(--zd_font_size9) ;
194
+ }
195
+
196
+ .size10 {
197
+ font-size: var(--zd_font_size10) ;
198
+ }
199
+
200
+ .size11 {
201
+ font-size: var(--zd_font_size11) ;
202
+ }
203
+
204
+ .size12 {
205
+ font-size: var(--zd_font_size12) ;
206
+ }
207
+
208
+ .size13 {
209
+ font-size: var(--zd_font_size13) ;
210
+ }
211
+
212
+ .size14 {
213
+ font-size: var(--zd_font_size14) ;
214
+ }
215
+
216
+ .size15 {
217
+ font-size: var(--zd_font_size15) ;
218
+ }
219
+
220
+ .size16 {
221
+ font-size: var(--zd_font_size16) ;
222
+ }
223
+
224
+ .size17 {
225
+ font-size: var(--zd_font_size17) ;
226
+ }
227
+
228
+ .size18 {
229
+ font-size: var(--zd_font_size18) ;
230
+ }
231
+
232
+ .size19 {
233
+ font-size: var(--zd_font_size19) ;
234
+ }
235
+
236
+ .size20 {
237
+ font-size: var(--zd_font_size20) ;
238
+ }
239
+
240
+ .size21 {
241
+ font-size: var(--zd_font_size21) ;
242
+ }
243
+
244
+ .size22 {
245
+ font-size: var(--zd_font_size22) ;
246
+ }
247
+
248
+ .size24 {
249
+ font-size: var(--zd_font_size24) ;
250
+ }
251
+
252
+ .size25 {
253
+ font-size: var(--zd_font_size25) ;
254
+ }
255
+
256
+ .size26 {
257
+ font-size: var(--zd_font_size26) ;
258
+ }
259
+
260
+ .size28 {
261
+ font-size: var(--zd_font_size28) ;
262
+ }
263
+
264
+ .size29 {
265
+ font-size: var(--zd_font_size29) ;
266
+ }
267
+
268
+ .size30 {
269
+ font-size: var(--zd_font_size30) ;
270
+ }
271
+
272
+ .size32 {
273
+ font-size: var(--zd_font_size32) ;
274
+ }
275
+
276
+ .size34 {
277
+ font-size: var(--zd_font_size34) ;
278
+ }
279
+
280
+ .size35 {
281
+ font-size: var(--zd_font_size35) ;
282
+ }
283
+
284
+ .size36 {
285
+ font-size: var(--zd_font_size36) ;
286
+ }
287
+
288
+ .size40 {
289
+ font-size: var(--zd_font_size40) ;
290
+ }
291
+
292
+ .size50 {
293
+ font-size: var(--zd_font_size50) ;
294
+ }
295
+
296
+ .sizeinherit {
297
+ font-size: inherit ;
298
+ }
299
+
300
+ /*...............Font Size End.........*/
301
+
302
+ /*............... Lineheight Start.........*/
303
+
304
+ .lineheight_inherit {
305
+ line-height: inherit;
306
+ }
307
+
308
+ .lineheight_initial {
309
+ line-height: initial;
310
+ }
311
+
312
+ .lineheight_normal {
313
+ line-height: normal;
314
+ }
315
+
316
+ .lineheight_0 {
317
+ line-height: 0;
318
+ }
319
+
320
+ .lineheight_0_1 {
321
+ line-height: 0.1;
322
+ }
323
+
324
+ .lineheight_0_2 {
325
+ line-height: 0.2;
326
+ }
327
+
328
+ .lineheight_0_3 {
329
+ line-height: 0.3;
330
+ }
331
+
332
+ .lineheight_0_4 {
333
+ line-height: 0.4;
334
+ }
335
+
336
+ .lineheight_0_5 {
337
+ line-height: 0.5;
338
+ }
339
+
340
+ .lineheight_0_6 {
341
+ line-height: 0.6;
342
+ }
343
+
344
+ .lineheight_0_7 {
345
+ line-height: 0.7;
346
+ }
347
+
348
+ .lineheight_0_8 {
349
+ line-height: 0.8;
350
+ }
351
+
352
+ .lineheight_0_9 {
353
+ line-height: 0.9;
354
+ }
355
+
356
+ .lineheight_1 {
357
+ line-height: 1;
358
+ }
359
+
360
+ .lineheight_1_1 {
361
+ line-height: 1.1;
362
+ }
363
+
364
+ .lineheight_1_2 {
365
+ line-height: 1.2;
366
+ }
367
+
368
+ .lineheight_1_3 {
369
+ line-height: 1.3;
370
+ }
371
+
372
+ .lineheight_1_4 {
373
+ line-height: 1.4;
374
+ }
375
+
376
+ .lineheight_1_5 {
377
+ line-height: 1.5;
378
+ }
379
+
380
+ .lineheight_1_6 {
381
+ line-height: 1.6;
382
+ }
383
+
384
+ .lineheight_1_7 {
385
+ line-height: 1.7;
386
+ }
387
+
388
+ .lineheight_1_8 {
389
+ line-height: 1.8;
390
+ }
391
+
392
+ .lineheight_1_9 {
393
+ line-height: 1.9;
394
+ }
395
+
396
+ .lineheight_2 {
397
+ line-height: 2;
398
+ }
399
+
400
+
401
+ /*............... Lineheight End.........*/
402
+
403
+ /*............... Letterspacing Start.........*/
404
+
405
+ .letterspacing_inherit {
406
+ letter-spacing: inherit;
407
+ }
408
+
409
+ .letterspacing_0_1 {
410
+ letter-spacing: 0.1px;
411
+ }
412
+
413
+ .letterspacing_0_2 {
414
+ letter-spacing: 0.2px;
415
+ }
416
+
417
+ .letterspacing_0_3 {
418
+ letter-spacing: 0.3px;
419
+ }
420
+
421
+ .letterspacing_0_4 {
422
+ letter-spacing: 0.4px;
423
+ }
424
+
425
+ .letterspacing_0_5 {
426
+ letter-spacing: 0.5px;
427
+ }
428
+
429
+ .letterspacing_0_6 {
430
+ letter-spacing: 0.6px;
431
+ }
432
+
433
+ .letterspacing_0_7 {
434
+ letter-spacing: 0.7px;
435
+ }
436
+
437
+ .letterspacing_0_8 {
438
+ letter-spacing: 0.8px;
439
+ }
440
+
441
+ .letterspacing_0_9 {
442
+ letter-spacing: 0.9px;
443
+ }
444
+
445
+ .letterspacing_1 {
446
+ letter-spacing: 1px;
447
+ }
448
+
449
+ .letterspacing_1_1 {
450
+ letter-spacing: 1.1px;
451
+ }
452
+
453
+ .letterspacing_1_2 {
454
+ letter-spacing: 1.2px;
455
+ }
456
+
457
+ .letterspacing_1_3 {
458
+ letter-spacing: 1.3px;
459
+ }
460
+
461
+ .letterspacing_1_4 {
462
+ letter-spacing: 1.4px;
463
+ }
464
+
465
+ .letterspacing_1_5 {
466
+ letter-spacing: 1.5px;
467
+ }
468
+
469
+ .letterspacing_1_6 {
470
+ letter-spacing: 1.6px;
471
+ }
472
+
473
+ .letterspacing_1_7 {
474
+ letter-spacing: 1.7px;
475
+ }
476
+
477
+ .letterspacing_1_8 {
478
+ letter-spacing: 1.8px;
479
+ }
480
+
481
+ .letterspacing_1_9 {
482
+ letter-spacing: 1.9px;
483
+ }
484
+
485
+ .letterspacing_2 {
486
+ letter-spacing: 2px;
487
+ }
488
+
489
+ /*............... Letterspacing End.........*/