@zohodesk/dot 1.0.0-temp-198.3.3 → 1.0.0-temp-199

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 (120) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +39 -0
  3. package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +1 -0
  4. package/assets/Appearance/light/mode/Dot_LightMode.module.css +1 -0
  5. package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +1 -0
  6. package/es/ActionButton/ActionButton.module.css +192 -192
  7. package/es/AlphabeticList/AlphabeticList.module.css +57 -57
  8. package/es/AttachmentViewer/AttachmentImage.js +68 -32
  9. package/es/AttachmentViewer/AttachmentViewer.js +120 -41
  10. package/es/AttachmentViewer/AttachmentViewer.module.css +364 -352
  11. package/es/AttachmentViewer/__tests__/AttachmentImage.spec.js +63 -13
  12. package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentImage.spec.js.snap +9 -5
  13. package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +16 -117
  14. package/es/AttachmentViewer/props/defaultProps.js +5 -1
  15. package/es/AttachmentViewer/props/propTypes.js +7 -3
  16. package/es/AttachmentViewer/utils.js +49 -0
  17. package/es/ChannelIcon/ChannelIcon.module.css +225 -225
  18. package/es/FormAction/FormAction.module.css +100 -100
  19. package/es/IconButton/IconButton.module.css +22 -22
  20. package/es/Image/Image.js +6 -2
  21. package/es/Image/props/propTypes.js +3 -1
  22. package/es/TagWithIcon/TagWithIcon.module.css +66 -66
  23. package/es/avatar/AvatarIcon/AvatarIcon.module.css +58 -58
  24. package/es/emptystate/CommonEmptyState/CommonEmptyState.module.css +92 -92
  25. package/es/form/fields/CurrencyField/CurrencyField.js +2 -1
  26. package/es/form/fields/TextEditor/TextEditor.js +64 -64
  27. package/es/form/fields/TextEditor/TextEditor.module.css +73 -61
  28. package/es/form/fields/TextEditor/__tests__/__snapshots__/TextEditor.spec.js.snap +1 -1
  29. package/es/form/fields/TextEditor/props/defaultProps.js +4 -1
  30. package/es/form/fields/TextEditor/props/propTypes.js +10 -3
  31. package/es/form/fields/ValidationMessage/ValidationMessage.module.css +27 -27
  32. package/es/layout/SubtabLayout/SubtabLayout.module.css +164 -164
  33. package/es/list/Comment/Comment.module.css +29 -29
  34. package/es/list/Dot/Dot.module.css +15 -15
  35. package/es/list/ListLayout/ListLayout.module.css +79 -79
  36. package/es/list/Subject/Subject.module.css +34 -34
  37. package/es/list/Thread/Thread.module.css +42 -42
  38. package/es/list/status/StatusDropdown/StatusDropdown.js +8 -2
  39. package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +16 -0
  40. package/es/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
  41. package/es/list/status/StatusDropdown/props/propTypes.js +2 -0
  42. package/es/lookup/header/Search/LookupSearch.module.css +26 -26
  43. package/es/lookup/header/Search/Search.js +55 -38
  44. package/es/lookup/header/Search/props/defaultProps.js +2 -1
  45. package/es/lookup/header/Search/props/propTypes.js +5 -1
  46. package/es/utils/editorUtils.js +6 -6
  47. package/es/v1/AttachmentViewer/AttachmentImage.js +44 -23
  48. package/es/v1/AttachmentViewer/AttachmentViewer.js +120 -41
  49. package/es/v1/AttachmentViewer/props/propTypes.js +7 -3
  50. package/es/v1/Image/Image.js +6 -2
  51. package/es/v1/Image/props/propTypes.js +3 -1
  52. package/es/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
  53. package/es/v1/form/fields/TextEditor/TextEditor.js +63 -64
  54. package/es/v1/form/fields/TextEditor/props/defaultProps.js +4 -1
  55. package/es/v1/form/fields/TextEditor/props/propTypes.js +10 -3
  56. package/es/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
  57. package/es/v1/list/status/StatusDropdown/props/propTypes.js +2 -0
  58. package/es/v1/utils/editorUtils.js +6 -6
  59. package/es/version2/GlobalNotification/GlobalNotification.module.css +177 -177
  60. package/es/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +87 -87
  61. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +132 -132
  62. package/lib/ActionButton/ActionButton.module.css +192 -192
  63. package/lib/AlphabeticList/AlphabeticList.module.css +57 -57
  64. package/lib/AttachmentViewer/AttachmentImage.js +74 -36
  65. package/lib/AttachmentViewer/AttachmentViewer.js +151 -70
  66. package/lib/AttachmentViewer/AttachmentViewer.module.css +364 -352
  67. package/lib/AttachmentViewer/__tests__/AttachmentImage.spec.js +64 -13
  68. package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentImage.spec.js.snap +9 -5
  69. package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +16 -117
  70. package/lib/AttachmentViewer/props/defaultProps.js +5 -1
  71. package/lib/AttachmentViewer/props/propTypes.js +7 -3
  72. package/lib/AttachmentViewer/utils.js +60 -1
  73. package/lib/ChannelIcon/ChannelIcon.module.css +225 -225
  74. package/lib/FormAction/FormAction.module.css +100 -100
  75. package/lib/IconButton/IconButton.module.css +22 -22
  76. package/lib/Image/Image.js +6 -2
  77. package/lib/Image/props/propTypes.js +3 -1
  78. package/lib/TagWithIcon/TagWithIcon.module.css +66 -66
  79. package/lib/avatar/AvatarIcon/AvatarIcon.module.css +58 -58
  80. package/lib/emptystate/CommonEmptyState/CommonEmptyState.module.css +92 -92
  81. package/lib/form/fields/CurrencyField/CurrencyField.js +2 -1
  82. package/lib/form/fields/TextEditor/TextEditor.js +74 -74
  83. package/lib/form/fields/TextEditor/TextEditor.module.css +73 -61
  84. package/lib/form/fields/TextEditor/__tests__/__snapshots__/TextEditor.spec.js.snap +1 -1
  85. package/lib/form/fields/TextEditor/props/defaultProps.js +4 -1
  86. package/lib/form/fields/TextEditor/props/propTypes.js +10 -3
  87. package/lib/form/fields/ValidationMessage/ValidationMessage.module.css +27 -27
  88. package/lib/layout/SubtabLayout/SubtabLayout.module.css +164 -164
  89. package/lib/list/Comment/Comment.module.css +29 -29
  90. package/lib/list/Dot/Dot.module.css +15 -15
  91. package/lib/list/ListLayout/ListLayout.module.css +79 -79
  92. package/lib/list/Subject/Subject.module.css +34 -34
  93. package/lib/list/Thread/Thread.module.css +42 -42
  94. package/lib/list/status/StatusDropdown/StatusDropdown.js +8 -2
  95. package/lib/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +14 -0
  96. package/lib/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
  97. package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
  98. package/lib/lookup/header/Search/LookupSearch.module.css +26 -26
  99. package/lib/lookup/header/Search/Search.js +73 -64
  100. package/lib/lookup/header/Search/props/defaultProps.js +2 -1
  101. package/lib/lookup/header/Search/props/propTypes.js +9 -3
  102. package/lib/utils/editorUtils.js +6 -5
  103. package/lib/v1/AttachmentViewer/AttachmentImage.js +52 -24
  104. package/lib/v1/AttachmentViewer/AttachmentViewer.js +151 -70
  105. package/lib/v1/AttachmentViewer/props/propTypes.js +7 -3
  106. package/lib/v1/Image/Image.js +6 -2
  107. package/lib/v1/Image/props/propTypes.js +3 -1
  108. package/lib/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
  109. package/lib/v1/form/fields/TextEditor/TextEditor.js +73 -74
  110. package/lib/v1/form/fields/TextEditor/props/defaultProps.js +4 -1
  111. package/lib/v1/form/fields/TextEditor/props/propTypes.js +10 -3
  112. package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
  113. package/lib/v1/list/status/StatusDropdown/props/propTypes.js +1 -1
  114. package/lib/v1/utils/editorUtils.js +6 -5
  115. package/lib/version2/GlobalNotification/GlobalNotification.module.css +177 -177
  116. package/lib/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +87 -87
  117. package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +132 -132
  118. package/package.json +6 -6
  119. package/result.json +1 -1
  120. package/unittest/index.html +6 -2
@@ -1,57 +1,57 @@
1
- /* $Id$ */
2
- .varClass {
3
- --textColor: var(--zdt_alphabeticList_text);
4
- --textHoverColor: var(--zdt_alphabeticList_hover_text);
5
- }
6
- .container {
7
- composes: varClass;
8
- composes: h100 from '~@zohodesk/components/lib/common/common.module.css';
9
- list-style: none;
10
- pointer-events: initial;
11
- margin: 0 ;
12
- padding: 0 ;
13
- }
14
- .column .title {
15
- margin-bottom: var(--zd_size3) ;
16
- }
17
- [dir=ltr] .row .title {
18
- margin-right: var(--zd_size3) ;
19
- }
20
- [dir=rtl] .row .title {
21
- margin-left: var(--zd_size3) ;
22
- }
23
- .row .letter {
24
- padding: 0 var(--zd_size3) ;
25
- }
26
- .column .letter {
27
- padding: var(--zd_size3) 0 ;
28
- }
29
- .heading {
30
- composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
31
- max-width: 100% ;
32
- }
33
- .list {
34
- font-size: var(--zd_font_size11) ;
35
- flex-basis: var(--zd_size12) ;
36
- color: var(--textColor);
37
- text-align: center;
38
- cursor: pointer;
39
- }
40
- .title {
41
- flex-basis: var(--zd_size15) ;
42
- }
43
- .letter {
44
- text-transform: uppercase;
45
- display: inline-block;
46
- }
47
- .numbers .list {
48
- max-height: var(--zd_size35) ;
49
- }
50
- .list :hover,
51
- .selected {
52
- color: var(--textHoverColor);
53
- }
54
- .title {
55
- font-size: var(--zd_font_size11) ;
56
- font-family: var(--zd_semibold);
57
- }
1
+ /* $Id$ */
2
+ .varClass {
3
+ --textColor: var(--zdt_alphabeticList_text);
4
+ --textHoverColor: var(--zdt_alphabeticList_hover_text);
5
+ }
6
+ .container {
7
+ composes: varClass;
8
+ composes: h100 from '~@zohodesk/components/lib/common/common.module.css';
9
+ list-style: none;
10
+ pointer-events: initial;
11
+ margin: 0 ;
12
+ padding: 0 ;
13
+ }
14
+ .column .title {
15
+ margin-bottom: var(--zd_size3) ;
16
+ }
17
+ [dir=ltr] .row .title {
18
+ margin-right: var(--zd_size3) ;
19
+ }
20
+ [dir=rtl] .row .title {
21
+ margin-left: var(--zd_size3) ;
22
+ }
23
+ .row .letter {
24
+ padding: 0 var(--zd_size3) ;
25
+ }
26
+ .column .letter {
27
+ padding: var(--zd_size3) 0 ;
28
+ }
29
+ .heading {
30
+ composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
31
+ max-width: 100% ;
32
+ }
33
+ .list {
34
+ font-size: var(--zd_font_size11) ;
35
+ flex-basis: var(--zd_size12) ;
36
+ color: var(--textColor);
37
+ text-align: center;
38
+ cursor: pointer;
39
+ }
40
+ .title {
41
+ flex-basis: var(--zd_size15) ;
42
+ }
43
+ .letter {
44
+ text-transform: uppercase;
45
+ display: inline-block;
46
+ }
47
+ .numbers .list {
48
+ max-height: var(--zd_size35) ;
49
+ }
50
+ .list :hover,
51
+ .selected {
52
+ color: var(--textHoverColor);
53
+ }
54
+ .title {
55
+ font-size: var(--zd_font_size11) ;
56
+ font-family: var(--zd_semibold);
57
+ }
@@ -9,10 +9,14 @@ exports["default"] = void 0;
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
+ var _Layout = require("@zohodesk/components/es/Layout");
13
+
12
14
  var _defaultProps = require("./props/defaultProps");
13
15
 
14
16
  var _propTypes = require("./props/propTypes");
15
17
 
18
+ var _utils = require("./utils");
19
+
16
20
  var _Image = _interopRequireDefault(require("../Image/Image"));
17
21
 
18
22
  var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
@@ -54,65 +58,99 @@ var AttachmentImage = /*#__PURE__*/function (_Component) {
54
58
  _classCallCheck(this, AttachmentImage);
55
59
 
56
60
  _this = _super.call(this, props);
57
- _this.imageEle = /*#__PURE__*/_react["default"].createRef();
58
61
  _this.state = {
59
- isLoading: true
62
+ isLoading: true,
63
+ isImageValid: false
60
64
  };
61
- _this.imgLoad = _this.imgLoad.bind(_assertThisInitialized(_this));
65
+ _this.handleImageValidation = _this.handleImageValidation.bind(_assertThisInitialized(_this));
66
+ _this.renderImage = _this.renderImage.bind(_assertThisInitialized(_this));
62
67
  return _this;
63
68
  }
64
69
 
65
70
  _createClass(AttachmentImage, [{
71
+ key: "handleImageValidation",
72
+ value: function handleImageValidation() {
73
+ var _this2 = this;
74
+
75
+ var src = this.props.src;
76
+ (0, _utils.checkImageValidity)(src).then(function (isValid) {
77
+ _this2.setState({
78
+ isLoading: false,
79
+ isImageValid: isValid
80
+ });
81
+ });
82
+ }
83
+ }, {
84
+ key: "renderImage",
85
+ value: function renderImage() {
86
+ var _this$props = this.props,
87
+ src = _this$props.src,
88
+ onClick = _this$props.onClick,
89
+ alt = _this$props.alt,
90
+ id = _this$props.id,
91
+ dataId = _this$props.dataId,
92
+ isCover = _this$props.isCover,
93
+ customClass = _this$props.customClass,
94
+ onLoad = _this$props.onLoad,
95
+ onError = _this$props.onError;
96
+ var isImageValid = this.state.isImageValid;
97
+ var _customClass$customIm = customClass.customImageClass,
98
+ customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm;
99
+ return /*#__PURE__*/_react["default"].createElement(_Image["default"], {
100
+ htmlId: id,
101
+ dataId: isImageValid ? dataId : "".concat(dataId, "_alt"),
102
+ src: src,
103
+ onClick: onClick,
104
+ className: customImageClass,
105
+ alt: alt,
106
+ isCover: isCover,
107
+ onLoad: onLoad,
108
+ onError: onError
109
+ });
110
+ }
111
+ }, {
66
112
  key: "componentDidMount",
67
113
  value: function componentDidMount() {
68
- var isImage = this.props.isImage;
114
+ this.handleImageValidation();
115
+ }
116
+ }, {
117
+ key: "componentDidUpdate",
118
+ value: function componentDidUpdate(prevProps) {
119
+ var src = this.props.src;
69
120
 
70
- if (isImage) {
71
- var image = this.imageEle.current;
72
- image.addEventListener('load', this.imgLoad);
73
- } else {
121
+ if (prevProps.src !== src) {
74
122
  this.setState({
75
- isLoading: false
123
+ isLoading: true
76
124
  });
125
+ this.handleImageValidation();
77
126
  }
78
127
  }
79
- }, {
80
- key: "imgLoad",
81
- value: function imgLoad() {
82
- this.setState({
83
- isLoading: false
84
- });
85
- var onLoad = this.props.onLoad;
86
- onLoad && onLoad();
87
- }
88
128
  }, {
89
129
  key: "render",
90
130
  value: function render() {
91
- var _this$props = this.props,
92
- src = _this$props.src,
93
- onClick = _this$props.onClick,
94
- alt = _this$props.alt,
95
- dataId = _this$props.dataId,
96
- id = _this$props.id,
97
- className = _this$props.className,
98
- isCover = _this$props.isCover;
99
- var isLoading = this.state.isLoading;
131
+ var _this$props2 = this.props,
132
+ dataId = _this$props2.dataId,
133
+ id = _this$props2.id,
134
+ customClass = _this$props2.customClass,
135
+ children = _this$props2.children;
136
+ var _this$state = this.state,
137
+ isLoading = _this$state.isLoading,
138
+ isImageValid = _this$state.isImageValid;
139
+ var _customClass$customCh = customClass.customChildrenClass,
140
+ customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
100
141
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isLoading ? /*#__PURE__*/_react["default"].createElement("div", {
101
142
  className: "".concat(_AttachmentViewerModule["default"].spinLoad),
102
143
  "data-id": "".concat(dataId, "_loader"),
103
144
  "data-test-id": "".concat(dataId, "_loader")
104
145
  }, /*#__PURE__*/_react["default"].createElement("div", {
105
146
  className: _AttachmentViewerModule["default"].loader
106
- })) : null, /*#__PURE__*/_react["default"].createElement(_Image["default"], {
147
+ })) : isImageValid ? this.renderImage() : children ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
148
+ align: "both",
107
149
  htmlId: id,
108
- eleRef: this.imageEle,
109
- dataId: dataId,
110
- src: src,
111
- onClick: onClick,
112
- className: "".concat(isLoading ? _AttachmentViewerModule["default"].hide : '', " ").concat(className),
113
- alt: alt,
114
- isCover: isCover
115
- }));
150
+ dataId: "".concat(dataId, "_custom"),
151
+ className: customChildrenClass
152
+ }, children) : this.renderImage() //alt ui
153
+ );
116
154
  }
117
155
  }]);
118
156