@zohodesk/dot 1.0.0-temp-203 → 1.0.0-temp-203.2

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 (51) hide show
  1. package/.cli/PropLessFiles.html +1 -1
  2. package/.cli/UnValidatedFiles.html +1 -1
  3. package/.cli/propValidation_report.html +1 -1
  4. package/README.md +4 -1
  5. package/es/FlipCard/__tests__/__snapshots__/FlipCard.spec.js.snap +2 -2
  6. package/es/form/fields/CheckBoxField/__tests__/__snapshots__/CheckBoxField.spec.js.snap +6 -6
  7. package/es/form/fields/PhoneField/PhoneField.js +0 -1
  8. package/es/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +24 -24
  9. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +4 -2
  10. package/es/form/fields/TagsMultiSelect/props/propTypes.js +2 -1
  11. package/es/form/fields/TextEditorField/TextEditorField.js +0 -1
  12. package/es/form/fields/TextEditorField/__tests__/__snapshots__/TextEditorField.spec.js.snap +1 -1
  13. package/es/form/fields/TextEditorWrapper/__tests__/__snapshots__/TextEditorWrapper.spec.js.snap +1 -1
  14. package/es/form/fields/TextareaField/__tests__/__snapshots__/TextareaField.spec.js.snap +1 -1
  15. package/es/list/AvatarFlip/__tests__/__snapshots__/AvatarFlip.spec.js.snap +2 -2
  16. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +1 -1
  17. package/lib/FlipCard/__tests__/__snapshots__/FlipCard.spec.js.snap +2 -2
  18. package/lib/form/fields/CheckBoxField/__tests__/__snapshots__/CheckBoxField.spec.js.snap +6 -6
  19. package/lib/form/fields/PhoneField/PhoneField.js +0 -1
  20. package/lib/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +24 -24
  21. package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +4 -2
  22. package/lib/form/fields/TagsMultiSelect/props/propTypes.js +2 -1
  23. package/lib/form/fields/TextEditorField/TextEditorField.js +0 -1
  24. package/lib/form/fields/TextEditorField/__tests__/__snapshots__/TextEditorField.spec.js.snap +1 -1
  25. package/lib/form/fields/TextEditorWrapper/__tests__/__snapshots__/TextEditorWrapper.spec.js.snap +1 -1
  26. package/lib/form/fields/TextareaField/__tests__/__snapshots__/TextareaField.spec.js.snap +1 -1
  27. package/lib/list/AvatarFlip/__tests__/__snapshots__/AvatarFlip.spec.js.snap +2 -2
  28. package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +1 -1
  29. package/package.json +6 -6
  30. package/es/services/context/AttachmentViewerContext.js +0 -37
  31. package/es/services/context/ToastNotificationContext.js +0 -49
  32. package/es/services/helpers/getAttributeValues.js +0 -19
  33. package/es/services/helpers/handleGloabeService.js +0 -16
  34. package/es/services/hoc/WithAttachmentViewer.js +0 -16
  35. package/es/services/hoc/WithEventPopup.js +0 -49
  36. package/es/services/hoc/WithToastNotification.js +0 -16
  37. package/es/services/hooks/useAttachmentViewerService.js +0 -8
  38. package/es/services/hooks/useEventService.js +0 -49
  39. package/es/services/hooks/useGlobalService.js +0 -13
  40. package/es/services/hooks/useToastNotificationService.js +0 -8
  41. package/lib/services/context/AttachmentViewerContext.js +0 -86
  42. package/lib/services/context/ToastNotificationContext.js +0 -112
  43. package/lib/services/helpers/getAttributeValues.js +0 -41
  44. package/lib/services/helpers/handleGloabeService.js +0 -28
  45. package/lib/services/hoc/WithAttachmentViewer.js +0 -35
  46. package/lib/services/hoc/WithEventPopup.js +0 -72
  47. package/lib/services/hoc/WithToastNotification.js +0 -35
  48. package/lib/services/hooks/useAttachmentViewerService.js +0 -19
  49. package/lib/services/hooks/useEventService.js +0 -62
  50. package/lib/services/hooks/useGlobalService.js +0 -22
  51. package/lib/services/hooks/useToastNotificationService.js +0 -19
@@ -24,7 +24,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
24
24
  >
25
25
  <div
26
26
  class="radio
27
- hoverprimary medium filled centerPathprimary shrinkOff"
27
+ hoverprimary medium filled centerPathprimary shrinkOff"
28
28
  data-id="boxComponent"
29
29
  data-selector-id="box"
30
30
  data-test-id="boxComponent"
@@ -51,7 +51,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
51
51
  </label>
52
52
  </div>
53
53
  <div
54
- class="text grow basis shrinkOff"
54
+ class="text grow basis shrinkOff"
55
55
  data-id="boxComponent"
56
56
  data-selector-id="box"
57
57
  data-test-id="boxComponent"
@@ -59,7 +59,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
59
59
  <label
60
60
  class="label title medium default font_primary
61
61
  dotted cursor
62
- primaryLabel pointer "
62
+ primaryLabel pointer "
63
63
  data-id="Chennai_label"
64
64
  data-selector-id="label"
65
65
  data-test-id="Chennai_label"
@@ -86,7 +86,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
86
86
  >
87
87
  <div
88
88
  class="radio
89
- medium filled centerPathprimary shrinkOff"
89
+ medium filled centerPathprimary disabled shrinkOff"
90
90
  data-id="boxComponent"
91
91
  data-selector-id="box"
92
92
  data-test-id="boxComponent"
@@ -113,7 +113,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
113
113
  </label>
114
114
  </div>
115
115
  <div
116
- class="text grow basis shrinkOff"
116
+ class="text disabled grow basis shrinkOff"
117
117
  data-id="boxComponent"
118
118
  data-selector-id="box"
119
119
  data-test-id="boxComponent"
@@ -121,7 +121,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
121
121
  <label
122
122
  class="label title medium default font_primary
123
123
  dotted cursor
124
- primaryLabel disabled "
124
+ primaryLabel "
125
125
  data-id="Mumbai_label"
126
126
  data-selector-id="label"
127
127
  data-test-id="Mumbai_label"
@@ -147,7 +147,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
147
147
  >
148
148
  <div
149
149
  class="radio
150
- hoverprimary medium filled centerPathprimary shrinkOff"
150
+ hoverprimary medium filled centerPathprimary shrinkOff"
151
151
  data-id="boxComponent"
152
152
  data-selector-id="box"
153
153
  data-test-id="boxComponent"
@@ -174,7 +174,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
174
174
  </label>
175
175
  </div>
176
176
  <div
177
- class="text grow basis shrinkOff"
177
+ class="text grow basis shrinkOff"
178
178
  data-id="boxComponent"
179
179
  data-selector-id="box"
180
180
  data-test-id="boxComponent"
@@ -182,7 +182,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
182
182
  <label
183
183
  class="label title medium default font_primary
184
184
  dotted cursor
185
- primaryLabel pointer "
185
+ primaryLabel pointer "
186
186
  data-id="Delhi_label"
187
187
  data-selector-id="label"
188
188
  data-test-id="Delhi_label"
@@ -217,7 +217,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
217
217
  >
218
218
  <div
219
219
  class="radio
220
- hoverprimary medium filled centerPathprimary shrinkOff"
220
+ hoverprimary medium filled centerPathprimary shrinkOff"
221
221
  data-id="boxComponent"
222
222
  data-selector-id="box"
223
223
  data-test-id="boxComponent"
@@ -244,7 +244,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
244
244
  </label>
245
245
  </div>
246
246
  <div
247
- class="text grow basis shrinkOff"
247
+ class="text grow basis shrinkOff"
248
248
  data-id="boxComponent"
249
249
  data-selector-id="box"
250
250
  data-test-id="boxComponent"
@@ -252,7 +252,7 @@ exports[`RadioField rendering options with isBoxStyle 1`] = `
252
252
  <label
253
253
  class="label title medium default font_primary
254
254
  dotted cursor
255
- primaryLabel pointer "
255
+ primaryLabel pointer "
256
256
  data-id="Kolkata_label"
257
257
  data-selector-id="label"
258
258
  data-test-id="Kolkata_label"
@@ -305,7 +305,7 @@ exports[`RadioField rendering with options 1`] = `
305
305
  >
306
306
  <div
307
307
  class="radio
308
- hoverprimary medium filled centerPathprimary shrinkOff"
308
+ hoverprimary medium filled centerPathprimary shrinkOff"
309
309
  data-id="boxComponent"
310
310
  data-selector-id="box"
311
311
  data-test-id="boxComponent"
@@ -332,7 +332,7 @@ exports[`RadioField rendering with options 1`] = `
332
332
  </label>
333
333
  </div>
334
334
  <div
335
- class="text grow basis shrinkOff"
335
+ class="text grow basis shrinkOff"
336
336
  data-id="boxComponent"
337
337
  data-selector-id="box"
338
338
  data-test-id="boxComponent"
@@ -340,7 +340,7 @@ exports[`RadioField rendering with options 1`] = `
340
340
  <label
341
341
  class="label title medium default font_primary
342
342
  dotted cursor
343
- primaryLabel pointer "
343
+ primaryLabel pointer "
344
344
  data-id="Chennai_label"
345
345
  data-selector-id="label"
346
346
  data-test-id="Chennai_label"
@@ -367,7 +367,7 @@ exports[`RadioField rendering with options 1`] = `
367
367
  >
368
368
  <div
369
369
  class="radio
370
- medium filled centerPathprimary shrinkOff"
370
+ medium filled centerPathprimary disabled shrinkOff"
371
371
  data-id="boxComponent"
372
372
  data-selector-id="box"
373
373
  data-test-id="boxComponent"
@@ -394,7 +394,7 @@ exports[`RadioField rendering with options 1`] = `
394
394
  </label>
395
395
  </div>
396
396
  <div
397
- class="text grow basis shrinkOff"
397
+ class="text disabled grow basis shrinkOff"
398
398
  data-id="boxComponent"
399
399
  data-selector-id="box"
400
400
  data-test-id="boxComponent"
@@ -402,7 +402,7 @@ exports[`RadioField rendering with options 1`] = `
402
402
  <label
403
403
  class="label title medium default font_primary
404
404
  dotted cursor
405
- primaryLabel disabled "
405
+ primaryLabel "
406
406
  data-id="Mumbai_label"
407
407
  data-selector-id="label"
408
408
  data-test-id="Mumbai_label"
@@ -428,7 +428,7 @@ exports[`RadioField rendering with options 1`] = `
428
428
  >
429
429
  <div
430
430
  class="radio
431
- hoverprimary medium filled centerPathprimary shrinkOff"
431
+ hoverprimary medium filled centerPathprimary shrinkOff"
432
432
  data-id="boxComponent"
433
433
  data-selector-id="box"
434
434
  data-test-id="boxComponent"
@@ -455,7 +455,7 @@ exports[`RadioField rendering with options 1`] = `
455
455
  </label>
456
456
  </div>
457
457
  <div
458
- class="text grow basis shrinkOff"
458
+ class="text grow basis shrinkOff"
459
459
  data-id="boxComponent"
460
460
  data-selector-id="box"
461
461
  data-test-id="boxComponent"
@@ -463,7 +463,7 @@ exports[`RadioField rendering with options 1`] = `
463
463
  <label
464
464
  class="label title medium default font_primary
465
465
  dotted cursor
466
- primaryLabel pointer "
466
+ primaryLabel pointer "
467
467
  data-id="Delhi_label"
468
468
  data-selector-id="label"
469
469
  data-test-id="Delhi_label"
@@ -498,7 +498,7 @@ exports[`RadioField rendering with options 1`] = `
498
498
  >
499
499
  <div
500
500
  class="radio
501
- hoverprimary medium filled centerPathprimary shrinkOff"
501
+ hoverprimary medium filled centerPathprimary shrinkOff"
502
502
  data-id="boxComponent"
503
503
  data-selector-id="box"
504
504
  data-test-id="boxComponent"
@@ -525,7 +525,7 @@ exports[`RadioField rendering with options 1`] = `
525
525
  </label>
526
526
  </div>
527
527
  <div
528
- class="text grow basis shrinkOff"
528
+ class="text grow basis shrinkOff"
529
529
  data-id="boxComponent"
530
530
  data-selector-id="box"
531
531
  data-test-id="boxComponent"
@@ -533,7 +533,7 @@ exports[`RadioField rendering with options 1`] = `
533
533
  <label
534
534
  class="label title medium default font_primary
535
535
  dotted cursor
536
- primaryLabel pointer "
536
+ primaryLabel pointer "
537
537
  data-id="Kolkata_label"
538
538
  data-selector-id="label"
539
539
  data-test-id="Kolkata_label"
@@ -213,7 +213,8 @@ var TagsMultiSelect = /*#__PURE__*/function (_React$Component) {
213
213
  positionsOffset = _this$props3.positionsOffset,
214
214
  targetOffset = _this$props3.targetOffset,
215
215
  customClass = _this$props3.customClass,
216
- customProps = _this$props3.customProps;
216
+ customProps = _this$props3.customProps,
217
+ isFocus = _this$props3.isFocus;
217
218
  var showAll = this.state.showAll;
218
219
  var chipLimit = !isPopupReady ? showAll ? tagsList.length : chipNeedToShow : tagsList.length;
219
220
  var _customClass$tagCusto = customClass.tagCustomClass,
@@ -228,8 +229,9 @@ var TagsMultiSelect = /*#__PURE__*/function (_React$Component) {
228
229
  TagWrapperProps = _customProps$TagWrapp === void 0 ? {} : _customProps$TagWrapp,
229
230
  _customProps$TagProps = customProps.TagProps,
230
231
  TagProps = _customProps$TagProps === void 0 ? {} : _customProps$TagProps;
232
+ var isEditable = !isReadOnly;
231
233
  return /*#__PURE__*/_react["default"].createElement("div", {
232
- className: "".concat(_TagsMultiSelectModule["default"].container, " ").concat(!isReadOnly ? " ".concat(needBorder ? _TagsMultiSelectModule["default"].hasBorder : '', "\n ").concat(needBorder ? _TagsMultiSelectModule["default"]["borderColor_".concat(borderColor)] : _TagsMultiSelectModule["default"].borderColor_transparent, " ").concat(isPopupReady && needBorder ? _TagsMultiSelectModule["default"].active : '') : '', " ").concat(className),
234
+ className: "".concat(_TagsMultiSelectModule["default"].container, " ").concat(!isReadOnly ? " ".concat(needBorder ? _TagsMultiSelectModule["default"].hasBorder : '', "\n ").concat(needBorder ? _TagsMultiSelectModule["default"]["borderColor_".concat(borderColor)] : _TagsMultiSelectModule["default"].borderColor_transparent, " ").concat(isPopupReady && needBorder || isEditable && isFocus ? _TagsMultiSelectModule["default"].active : '') : '', " ").concat(className),
233
235
  onClick: _General.stopBubbling,
234
236
  "data-id": "".concat(dataId, "_tagsContainer"),
235
237
  "data-test-id": "".concat(dataId, "_tagsContainer"),
@@ -63,6 +63,7 @@ var propTypes = {
63
63
  TextBoxIconProps: _propTypes["default"].object,
64
64
  TagWrapperProps: _propTypes["default"].object,
65
65
  TagProps: _propTypes["default"].object
66
- })
66
+ }),
67
+ isFocus: _propTypes["default"].bool
67
68
  };
68
69
  exports.propTypes = propTypes;
@@ -148,7 +148,6 @@ var TextEditorField = /*#__PURE__*/function (_PureComponent) {
148
148
  needInlineAttachment = _this$props4.needInlineAttachment,
149
149
  i18nKeys = _this$props4.i18nKeys,
150
150
  className = _this$props4.className,
151
- children = _this$props4.children,
152
151
  ePhiData = _this$props4.ePhiData,
153
152
  customProps = _this$props4.customProps;
154
153
  var _customProps$LabelPro = customProps.LabelProps,
@@ -14,7 +14,7 @@ exports[`TextEditorField rendering the defult props 1`] = `
14
14
  data-selector-id="textEditorWrapper"
15
15
  >
16
16
  <textarea
17
- class="textBox container xsmall primary needBorder noresize effect borderColor_default"
17
+ class="textBox container xsmall primary needBorder noresize effect borderColor_default"
18
18
  data-id="TextareaComp"
19
19
  data-selector-id="textarea"
20
20
  data-test-id="TextareaComp"
@@ -7,7 +7,7 @@ exports[`TextEditorWrapper rendering the defult props 1`] = `
7
7
  data-selector-id="textEditorWrapper"
8
8
  >
9
9
  <textarea
10
- class="textBox container small primary needBorder noresize smallanimated effect borderColor_default"
10
+ class="textBox container small primary needBorder noresize smallanimated effect borderColor_default"
11
11
  data-id="TextareaComp"
12
12
  data-selector-id="textarea"
13
13
  data-test-id="TextareaComp"
@@ -10,7 +10,7 @@ exports[`TextareaField rendering the defult props 1`] = `
10
10
  class="fieldContainer "
11
11
  >
12
12
  <textarea
13
- class=" container xsmall primary needBorder resizeY xsmallanimated effect borderColor_default"
13
+ class=" container xsmall primary needBorder resizeY xsmallanimated effect borderColor_default"
14
14
  data-id="property(undefined)"
15
15
  data-selector-id="textarea"
16
16
  data-test-id="property(undefined)"
@@ -21,7 +21,7 @@ exports[`AvatarFlip rendering the defult props 1`] = `
21
21
  <div
22
22
  aria-checked="false"
23
23
  class="container pointer primary
24
- inflex rowdir vCenter"
24
+ inflex rowdir vCenter"
25
25
  data-id="listViewCheckBox_undefined"
26
26
  data-selector-id="container"
27
27
  data-test-id="listViewCheckBox_undefined"
@@ -29,7 +29,7 @@ exports[`AvatarFlip rendering the defult props 1`] = `
29
29
  tabindex="0"
30
30
  >
31
31
  <div
32
- class="boxContainer medium filled shrinkOff"
32
+ class="boxContainer medium filled shrinkOff"
33
33
  data-id="boxComponent"
34
34
  data-selector-id="box"
35
35
  data-test-id="boxComponent"
@@ -21,7 +21,7 @@ var _AlertIcons = _interopRequireDefault(require("../../alertIcons/AlertIcons"))
21
21
 
22
22
  var _CustomResponsive = require("@zohodesk/components/lib/Responsive/CustomResponsive");
23
23
 
24
- var _Typography = _interopRequireDefault(require("@zohodesk/components/es/Typography/Typography"));
24
+ var _Typography = _interopRequireDefault(require("@zohodesk/components/es/v1/Typography/Typography"));
25
25
 
26
26
  var _DesktopNotificationHeaderModule = _interopRequireDefault(require("./DesktopNotificationHeader.module.css"));
27
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/dot",
3
- "version": "1.0.0-temp-203",
3
+ "version": "1.0.0-temp-203.2",
4
4
  "main": "lib/index",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -63,10 +63,10 @@
63
63
  "@zohodesk-private/node-plugins": "1.1.8",
64
64
  "@zohodesk-private/react-prop-validator": "1.2.3",
65
65
  "@zohodesk/a11y": "2.2.6",
66
- "@zohodesk/components": "1.2.52",
67
- "@zohodesk/dotkit": "1.0.0-temp-0",
66
+ "@zohodesk/components": "1.2.53",
67
+ "@zohodesk/dotkit": "1.0.0-temp-0.2",
68
68
  "@zohodesk/hooks": "2.0.5",
69
- "@zohodesk/icons": "1.0.69",
69
+ "@zohodesk/icons": "1.0.70",
70
70
  "@zohodesk/svg": "1.1.22",
71
71
  "@zohodesk/utils": "1.3.14",
72
72
  "@zohodesk/variables": "1.0.0",
@@ -78,8 +78,8 @@
78
78
  "peerDependencies": {
79
79
  "velocity-react": "1.4.3",
80
80
  "@zohodesk/variables": "1.0.0",
81
- "@zohodesk/components": "1.2.52",
82
- "@zohodesk/icons": "1.0.69",
81
+ "@zohodesk/components": "1.2.53",
82
+ "@zohodesk/icons": "1.0.70",
83
83
  "@zohodesk/svg": "1.1.22",
84
84
  "@zohodesk/virtualizer": "1.0.3",
85
85
  "react-sortable-hoc": "^0.8.3",
@@ -1,37 +0,0 @@
1
- import React, { createContext, useState, useCallback, useMemo } from 'react';
2
- import AttachmentViewer from '../components/Attachment/AttachmentViewer';
3
- import useGlobalService from '../hooks/useGlobalService';
4
- export const AttachmentViewerContext = /*#__PURE__*/createContext();
5
- export const AttachmentViewerProvider = props => {
6
- const {
7
- children
8
- } = props;
9
- const modifiedProps = { ...props
10
- };
11
- delete modifiedProps.children;
12
- const [attachment, setAttachment] = useState({});
13
- const showAttachmentViewer = useCallback(attachment => {
14
- setAttachment(attachment);
15
- }, []);
16
- const hideAttachmentViewer = useCallback(() => {
17
- setAttachment({});
18
- }, []);
19
- const contextValue = useMemo(() => ({
20
- attachment,
21
- showAttachmentViewer,
22
- hideAttachmentViewer
23
- }), [attachment]);
24
- useGlobalService('attachmentViewer', {
25
- showAttachmentViewer,
26
- hideAttachmentViewer
27
- });
28
- return /*#__PURE__*/React.createElement(AttachmentViewerContext.Provider, {
29
- value: contextValue
30
- }, children, /*#__PURE__*/React.createElement(AttachmentViewer, {
31
- attachment: attachment,
32
- hideAttachmentViewer: hideAttachmentViewer,
33
- ...modifiedProps
34
- }));
35
- };
36
- export const AttachmentViewerConsumer = AttachmentViewerContext.Consumer;
37
- export default AttachmentViewerContext;
@@ -1,49 +0,0 @@
1
- import React, { createContext, useState, useRef, useCallback, useMemo } from 'react';
2
- import ToastNotification from '../components/ToastNotification/ToastNotification';
3
- import useGlobalService from '../hooks/useGlobalService';
4
- export const ToastNotificationContext = /*#__PURE__*/createContext();
5
- export const ToastNotificationProvider = props => {
6
- const {
7
- children
8
- } = props;
9
- const modifiedProps = { ...props
10
- };
11
- delete modifiedProps.children;
12
- const [toastMessages, setToastMessages] = useState([]);
13
- const toastIdCounter = useRef(0);
14
- const showToastNotification = useCallback(message => {
15
- const id = `toast${toastIdCounter.current++}`;
16
- const toastMessage = {
17
- id,
18
- data: message
19
- };
20
- setToastMessages(prevMessages => [...prevMessages, toastMessage]);
21
- }, []);
22
- const hideToastNotification = useCallback(id => {
23
- setToastMessages(prevMessages => prevMessages.filter(message => message.id !== id));
24
- }, []);
25
- const clearToastNotifications = useCallback(() => {
26
- setToastMessages([]);
27
- }, []);
28
- const contextValue = useMemo(() => ({
29
- toastMessages,
30
- showToastNotification,
31
- hideToastNotification,
32
- clearToastNotifications
33
- }), [toastMessages]);
34
- useGlobalService('toastNotification', {
35
- showToastNotification,
36
- hideToastNotification,
37
- clearToastNotifications
38
- });
39
- return /*#__PURE__*/React.createElement(ToastNotificationContext.Provider, {
40
- value: contextValue
41
- }, children, /*#__PURE__*/React.createElement(ToastNotification, {
42
- messages: toastMessages,
43
- hideToastNotification: hideToastNotification,
44
- clearToastNotifications: clearToastNotifications,
45
- ...modifiedProps
46
- }));
47
- };
48
- export const ToastNotificationConsumer = ToastNotificationContext.Consumer;
49
- export default ToastNotificationContext;
@@ -1,19 +0,0 @@
1
- export default function getAttributeValues(_ref) {
2
- let {
3
- element,
4
- attributes
5
- } = _ref;
6
- const values = {};
7
-
8
- for (let attr of attributes) {
9
- const value = element.getAttribute(attr);
10
- const key = attr.replace('data-', '');
11
-
12
- if (value) {
13
- values[key] = value;
14
- }
15
- }
16
-
17
- return values;
18
- }
19
- ;
@@ -1,16 +0,0 @@
1
- export const setGlobalService = (serviceName, serviceFunctions) => {
2
- if (!global.DOTServices) {
3
- global.DOTServices = {};
4
- }
5
-
6
- global.DOTServices[serviceName] = serviceFunctions;
7
- };
8
- export const removeGlobalService = serviceName => {
9
- if (global.DOTServices && global.DOTServices[serviceName]) {
10
- delete global.DOTServices[serviceName];
11
- }
12
-
13
- if (global.DOTServices && Object.keys(global.DOTServices).length === 0) {
14
- delete global.DOTServices;
15
- }
16
- };
@@ -1,16 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import useAttachmentViewerService from '../hooks/useAttachmentViewerService';
3
-
4
- const WithAttachmentViewer = Component => {
5
- const WrappedComponent = /*#__PURE__*/forwardRef((props, ref) => {
6
- const attachmentViewerProperties = useAttachmentViewerService();
7
- return /*#__PURE__*/React.createElement(Component, { ...props,
8
- ref: ref,
9
- attachmentViewerProperties: attachmentViewerProperties
10
- });
11
- });
12
- WrappedComponent.displayName = `WithAttachmentViewer(${Component.displayName || Component.name || 'Component'})`;
13
- return WrappedComponent;
14
- };
15
-
16
- export default WithAttachmentViewer;
@@ -1,49 +0,0 @@
1
- import React, { useCallback, forwardRef, useMemo } from 'react';
2
- import { Popup } from '@zohodesk/components';
3
- import { cancelBubblingEffect } from '@zohodesk/components/es/utils/Common';
4
- import useEventService from '../hooks/useEventService';
5
-
6
- const WithEventPopup = function (Component) {
7
- let properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8
- const {
9
- onClick
10
- } = properties;
11
- const WrappedComponent = /*#__PURE__*/forwardRef((props, ref) => {
12
- const {
13
- isPopupOpen,
14
- getTargetRef,
15
- togglePopup,
16
- attributes = [],
17
- keyAttribute
18
- } = props;
19
-
20
- const _togglePopup = useCallback(event => {
21
- cancelBubblingEffect(event);
22
-
23
- if (typeof onClick === 'function') {
24
- onClick(event);
25
- }
26
-
27
- getTargetRef(event.target);
28
- togglePopup(event);
29
- }, [getTargetRef, togglePopup]);
30
-
31
- const {
32
- attributeValues
33
- } = useEventService({
34
- attributes,
35
- keyAttribute,
36
- isRendered: isPopupOpen,
37
- onClick: _togglePopup
38
- });
39
- const memoizedAttributeValues = useMemo(() => attributeValues, [attributeValues]);
40
- return isPopupOpen ? /*#__PURE__*/React.createElement(Component, { ...props,
41
- ref: ref,
42
- attributeValues: memoizedAttributeValues
43
- }) : null;
44
- });
45
- WrappedComponent.displayName = `WithEventPopup(${Component.displayName || Component.name || 'Component'})`;
46
- return WrappedComponent;
47
- };
48
-
49
- export default (Component => Popup(WithEventPopup(Component)));
@@ -1,16 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import useToastNotificationService from '../hooks/useToastNotificationService';
3
-
4
- const WithToastNotification = Component => {
5
- const WrappedComponent = /*#__PURE__*/forwardRef((props, ref) => {
6
- const toastProperties = useToastNotificationService();
7
- return /*#__PURE__*/React.createElement(Component, { ...props,
8
- ref: ref,
9
- toastProperties: toastProperties
10
- });
11
- });
12
- WrappedComponent.displayName = `WithToastNotification(${Component.displayName || Component.name || 'Component'})`;
13
- return WrappedComponent;
14
- };
15
-
16
- export default WithToastNotification;
@@ -1,8 +0,0 @@
1
- import { useContext } from 'react';
2
- import AttachmentViewerContext from '../context/AttachmentViewerContext';
3
-
4
- const useAttachmentViewerService = () => {
5
- return useContext(AttachmentViewerContext);
6
- };
7
-
8
- export default useAttachmentViewerService;
@@ -1,49 +0,0 @@
1
- import { useCallback, useEffect, useMemo, useRef } from 'react';
2
- import { cancelBubblingEffect } from '@zohodesk/components/es/utils/Common';
3
- import getAttributeValues from '../helpers/getAttributeValues';
4
-
5
- const useEventService = properties => {
6
- const {
7
- attributes = [],
8
- keyAttribute,
9
- isRendered,
10
- onClick
11
- } = properties;
12
- const attributesValue = useRef({});
13
- useEffect(() => {
14
- if (!isRendered) {
15
- attributesValue.current = {};
16
- }
17
- }, [isRendered]);
18
- const handleClick = useCallback(event => {
19
- cancelBubblingEffect(event);
20
- const target = event.target.getAttribute(keyAttribute) || event.target.closest(`[${keyAttribute}]`);
21
-
22
- if (target) {
23
- const attributeData = getAttributeValues({
24
- element: event.target,
25
- attributes
26
- });
27
-
28
- if (Object.keys(attributeData).length > 0) {
29
- attributesValue.current = attributeData;
30
- }
31
-
32
- if (typeof onClick === 'function') {
33
- onClick(event);
34
- }
35
- }
36
- }, [attributes, keyAttribute, onClick]);
37
- useEffect(() => {
38
- document.addEventListener('click', handleClick);
39
- return () => {
40
- document.removeEventListener('click', handleClick);
41
- };
42
- }, [handleClick]);
43
- const attributeValues = useMemo(() => attributesValue.current, [attributesValue.current]);
44
- return {
45
- attributeValues
46
- };
47
- };
48
-
49
- export default useEventService;
@@ -1,13 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { removeGlobalService, setGlobalService } from "../helpers/handleGloabeService";
3
-
4
- const useGlobalService = (serviceName, serviceFunctions) => {
5
- useEffect(() => {
6
- setGlobalService(serviceName, serviceFunctions);
7
- return () => {
8
- removeGlobalService(serviceName);
9
- };
10
- }, [serviceName, serviceFunctions]);
11
- };
12
-
13
- export default useGlobalService;
@@ -1,8 +0,0 @@
1
- import { useContext } from 'react';
2
- import ToastNotificationContext from '../context/ToastNotificationContext';
3
-
4
- const useToastNotificationService = () => {
5
- return useContext(ToastNotificationContext);
6
- };
7
-
8
- export default useToastNotificationService;