@zohodesk/dot 1.0.0-temp-187.1 → 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 (162) hide show
  1. package/.cli/UnValidatedFiles.html +1 -1
  2. package/.cli/propValidation_report.html +1 -1
  3. package/README.md +11 -0
  4. package/es/DotProvider/DotProvider.js +60 -0
  5. package/es/DotProvider/hooks/useDotProvider.js +55 -0
  6. package/es/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +97 -0
  7. package/es/DotProvider/libraryChunks/themes/component/blue/Blue_Dark_Component.js +3 -0
  8. package/es/DotProvider/libraryChunks/themes/component/blue/Blue_Light_Component.js +3 -0
  9. package/es/DotProvider/libraryChunks/themes/component/blue/Blue_PureDark_Component.js +3 -0
  10. package/es/DotProvider/libraryChunks/themes/component/green/Green_Dark_Component.js +3 -0
  11. package/es/DotProvider/libraryChunks/themes/component/green/Green_Light_Component.js +3 -0
  12. package/es/DotProvider/libraryChunks/themes/component/green/Green_PureDark_Component.js +3 -0
  13. package/es/DotProvider/libraryChunks/themes/component/orange/Orange_Dark_Component.js +3 -0
  14. package/es/DotProvider/libraryChunks/themes/component/orange/Orange_Light_Component.js +3 -0
  15. package/es/DotProvider/libraryChunks/themes/component/orange/Orange_PureDark_Component.js +3 -0
  16. package/es/DotProvider/libraryChunks/themes/component/red/Red_Dark_Component.js +3 -0
  17. package/es/DotProvider/libraryChunks/themes/component/red/Red_Light_Component.js +3 -0
  18. package/es/DotProvider/libraryChunks/themes/component/red/Red_PureDark_Component.js +3 -0
  19. package/es/DotProvider/libraryChunks/themes/component/yellow/Yellow_Dark_Component.js +3 -0
  20. package/es/DotProvider/libraryChunks/themes/component/yellow/Yellow_Light_Component.js +3 -0
  21. package/es/DotProvider/libraryChunks/themes/component/yellow/Yellow_PureDark_Component.js +3 -0
  22. package/es/DotProvider/libraryChunks/themes/dot/blue/Blue_Dark_Dot.js +1 -0
  23. package/es/DotProvider/libraryChunks/themes/dot/blue/Blue_Light_Dot.js +1 -0
  24. package/es/DotProvider/libraryChunks/themes/dot/blue/Blue_PureDark_Dot.js +1 -0
  25. package/es/DotProvider/libraryChunks/themes/dot/green/Green_Dark_Dot.js +1 -0
  26. package/es/DotProvider/libraryChunks/themes/dot/green/Green_Light_Dot.js +1 -0
  27. package/es/DotProvider/libraryChunks/themes/dot/green/Green_PureDark_Dot.js +1 -0
  28. package/es/DotProvider/libraryChunks/themes/dot/orange/Orange_Dark_Dot.js +1 -0
  29. package/es/DotProvider/libraryChunks/themes/dot/orange/Orange_Light_Dot.js +1 -0
  30. package/es/DotProvider/libraryChunks/themes/dot/orange/Orange_PureDark_Dot.js +1 -0
  31. package/es/DotProvider/libraryChunks/themes/dot/red/Red_Dark_Dot.js +1 -0
  32. package/es/DotProvider/libraryChunks/themes/dot/red/Red_Light_Dot.js +1 -0
  33. package/es/DotProvider/libraryChunks/themes/dot/red/Red_PureDark_Dot.js +1 -0
  34. package/es/DotProvider/libraryChunks/themes/dot/yellow/Yellow_Dark_Dot.js +1 -0
  35. package/es/DotProvider/libraryChunks/themes/dot/yellow/Yellow_Light_Dot.js +1 -0
  36. package/es/DotProvider/libraryChunks/themes/dot/yellow/Yellow_PureDark_Dot.js +1 -0
  37. package/es/DotProvider/libraryChunks/themes/svg/blue/Blue_Dark_SVG.js +1 -0
  38. package/es/DotProvider/libraryChunks/themes/svg/blue/Blue_Light_SVG.js +1 -0
  39. package/es/DotProvider/libraryChunks/themes/svg/blue/Blue_PureDark_SVG.js +1 -0
  40. package/es/DotProvider/libraryChunks/themes/svg/green/Green_Dark_SVG.js +1 -0
  41. package/es/DotProvider/libraryChunks/themes/svg/green/Green_Light_SVG.js +1 -0
  42. package/es/DotProvider/libraryChunks/themes/svg/green/Green_PureDark_SVG.js +1 -0
  43. package/es/DotProvider/libraryChunks/themes/svg/orange/Orange_Dark_SVG.js +1 -0
  44. package/es/DotProvider/libraryChunks/themes/svg/orange/Orange_Light_SVG.js +1 -0
  45. package/es/DotProvider/libraryChunks/themes/svg/orange/Orange_PureDark_SVG.js +1 -0
  46. package/es/DotProvider/libraryChunks/themes/svg/red/Red_Dark_SVG.js +1 -0
  47. package/es/DotProvider/libraryChunks/themes/svg/red/Red_Light_SVG.js +1 -0
  48. package/es/DotProvider/libraryChunks/themes/svg/red/Red_PureDark_SVG.js +1 -0
  49. package/es/DotProvider/libraryChunks/themes/svg/yellow/Yellow_Dark_SVG.js +1 -0
  50. package/es/DotProvider/libraryChunks/themes/svg/yellow/Yellow_Light_SVG.js +1 -0
  51. package/es/DotProvider/libraryChunks/themes/svg/yellow/Yellow_PureDark_SVG.js +1 -0
  52. package/es/DotProvider/props/defaultProps.js +11 -0
  53. package/es/DotProvider/props/propTypes.js +16 -0
  54. package/es/DotProvider/utils/assetPromiseHandlers/fontSizeAssetPromise.js +4 -0
  55. package/es/DotProvider/utils/assetPromiseHandlers/themeAppearanceAssetPromise.js +28 -0
  56. package/es/DotProvider/utils/assetPromiseHandlers/themeColorAssetPromise.js +29 -0
  57. package/es/DotProvider/utils/assetPromiseHandlers/zoomSizeAssetPromise.js +4 -0
  58. package/es/DotProvider/utils/constants.js +14 -0
  59. package/es/DotProvider/utils/errorValidation.js +17 -0
  60. package/es/DotProvider/utils/getAssetsImportPromises.js +17 -0
  61. package/es/DotProvider/utils/sizeAssetsConfig.js +12 -0
  62. package/es/DotProvider/utils/themeAppearanceAssetsConfig.js +47 -0
  63. package/es/DotProvider/utils/themeColorAssetsConfig.js +221 -0
  64. package/es/common/dot_boxShadow.module.css +0 -2
  65. package/es/form/fields/CurrencyField/CurrencyField.js +2 -1
  66. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +2 -4
  67. package/es/list/DepartmentDropDown/DepartmentDropDown.js +2 -7
  68. package/es/list/DepartmentDropDown/props/defaultProps.js +1 -2
  69. package/es/list/DepartmentDropDown/props/propTypes.js +1 -2
  70. package/es/list/status/StatusDropdown/StatusDropdown.js +8 -2
  71. package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +16 -0
  72. package/es/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
  73. package/es/list/status/StatusDropdown/props/propTypes.js +2 -0
  74. package/es/list/status/StatusListItem/StatusListItem.module.css +5 -35
  75. package/es/lookup/header/Search/LookupSearch.module.css +26 -26
  76. package/es/lookup/header/Search/Search.js +55 -38
  77. package/es/lookup/header/Search/props/defaultProps.js +2 -1
  78. package/es/lookup/header/Search/props/propTypes.js +5 -1
  79. package/es/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
  80. package/es/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
  81. package/es/v1/list/status/StatusDropdown/props/propTypes.js +2 -0
  82. package/lib/DotProvider/DotProvider.js +88 -0
  83. package/lib/DotProvider/hooks/useDotProvider.js +83 -0
  84. package/lib/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +119 -0
  85. package/lib/DotProvider/libraryChunks/themes/component/blue/Blue_Dark_Component.js +7 -0
  86. package/lib/DotProvider/libraryChunks/themes/component/blue/Blue_Light_Component.js +7 -0
  87. package/lib/DotProvider/libraryChunks/themes/component/blue/Blue_PureDark_Component.js +7 -0
  88. package/lib/DotProvider/libraryChunks/themes/component/green/Green_Dark_Component.js +7 -0
  89. package/lib/DotProvider/libraryChunks/themes/component/green/Green_Light_Component.js +7 -0
  90. package/lib/DotProvider/libraryChunks/themes/component/green/Green_PureDark_Component.js +7 -0
  91. package/lib/DotProvider/libraryChunks/themes/component/orange/Orange_Dark_Component.js +7 -0
  92. package/lib/DotProvider/libraryChunks/themes/component/orange/Orange_Light_Component.js +7 -0
  93. package/lib/DotProvider/libraryChunks/themes/component/orange/Orange_PureDark_Component.js +7 -0
  94. package/lib/DotProvider/libraryChunks/themes/component/red/Red_Dark_Component.js +7 -0
  95. package/lib/DotProvider/libraryChunks/themes/component/red/Red_Light_Component.js +7 -0
  96. package/lib/DotProvider/libraryChunks/themes/component/red/Red_PureDark_Component.js +7 -0
  97. package/lib/DotProvider/libraryChunks/themes/component/yellow/Yellow_Dark_Component.js +7 -0
  98. package/lib/DotProvider/libraryChunks/themes/component/yellow/Yellow_Light_Component.js +7 -0
  99. package/lib/DotProvider/libraryChunks/themes/component/yellow/Yellow_PureDark_Component.js +7 -0
  100. package/lib/DotProvider/libraryChunks/themes/dot/blue/Blue_Dark_Dot.js +3 -0
  101. package/lib/DotProvider/libraryChunks/themes/dot/blue/Blue_Light_Dot.js +3 -0
  102. package/lib/DotProvider/libraryChunks/themes/dot/blue/Blue_PureDark_Dot.js +3 -0
  103. package/lib/DotProvider/libraryChunks/themes/dot/green/Green_Dark_Dot.js +3 -0
  104. package/lib/DotProvider/libraryChunks/themes/dot/green/Green_Light_Dot.js +3 -0
  105. package/lib/DotProvider/libraryChunks/themes/dot/green/Green_PureDark_Dot.js +3 -0
  106. package/lib/DotProvider/libraryChunks/themes/dot/orange/Orange_Dark_Dot.js +3 -0
  107. package/lib/DotProvider/libraryChunks/themes/dot/orange/Orange_Light_Dot.js +3 -0
  108. package/lib/DotProvider/libraryChunks/themes/dot/orange/Orange_PureDark_Dot.js +3 -0
  109. package/lib/DotProvider/libraryChunks/themes/dot/red/Red_Dark_Dot.js +3 -0
  110. package/lib/DotProvider/libraryChunks/themes/dot/red/Red_Light_Dot.js +3 -0
  111. package/lib/DotProvider/libraryChunks/themes/dot/red/Red_PureDark_Dot.js +3 -0
  112. package/lib/DotProvider/libraryChunks/themes/dot/yellow/Yellow_Dark_Dot.js +3 -0
  113. package/lib/DotProvider/libraryChunks/themes/dot/yellow/Yellow_Light_Dot.js +3 -0
  114. package/lib/DotProvider/libraryChunks/themes/dot/yellow/Yellow_PureDark_Dot.js +3 -0
  115. package/lib/DotProvider/libraryChunks/themes/svg/blue/Blue_Dark_SVG.js +3 -0
  116. package/lib/DotProvider/libraryChunks/themes/svg/blue/Blue_Light_SVG.js +3 -0
  117. package/lib/DotProvider/libraryChunks/themes/svg/blue/Blue_PureDark_SVG.js +3 -0
  118. package/lib/DotProvider/libraryChunks/themes/svg/green/Green_Dark_SVG.js +3 -0
  119. package/lib/DotProvider/libraryChunks/themes/svg/green/Green_Light_SVG.js +3 -0
  120. package/lib/DotProvider/libraryChunks/themes/svg/green/Green_PureDark_SVG.js +3 -0
  121. package/lib/DotProvider/libraryChunks/themes/svg/orange/Orange_Dark_SVG.js +3 -0
  122. package/lib/DotProvider/libraryChunks/themes/svg/orange/Orange_Light_SVG.js +3 -0
  123. package/lib/DotProvider/libraryChunks/themes/svg/orange/Orange_PureDark_SVG.js +3 -0
  124. package/lib/DotProvider/libraryChunks/themes/svg/red/Red_Dark_SVG.js +3 -0
  125. package/lib/DotProvider/libraryChunks/themes/svg/red/Red_Light_SVG.js +3 -0
  126. package/lib/DotProvider/libraryChunks/themes/svg/red/Red_PureDark_SVG.js +3 -0
  127. package/lib/DotProvider/libraryChunks/themes/svg/yellow/Yellow_Dark_SVG.js +3 -0
  128. package/lib/DotProvider/libraryChunks/themes/svg/yellow/Yellow_Light_SVG.js +3 -0
  129. package/lib/DotProvider/libraryChunks/themes/svg/yellow/Yellow_PureDark_SVG.js +3 -0
  130. package/lib/DotProvider/props/defaultProps.js +20 -0
  131. package/lib/DotProvider/props/propTypes.js +28 -0
  132. package/lib/DotProvider/utils/assetPromiseHandlers/fontSizeAssetPromise.js +12 -0
  133. package/lib/DotProvider/utils/assetPromiseHandlers/themeAppearanceAssetPromise.js +39 -0
  134. package/lib/DotProvider/utils/assetPromiseHandlers/themeColorAssetPromise.js +40 -0
  135. package/lib/DotProvider/utils/assetPromiseHandlers/zoomSizeAssetPromise.js +12 -0
  136. package/lib/DotProvider/utils/constants.js +34 -0
  137. package/lib/DotProvider/utils/errorValidation.js +25 -0
  138. package/lib/DotProvider/utils/getAssetsImportPromises.js +22 -0
  139. package/lib/DotProvider/utils/sizeAssetsConfig.js +31 -0
  140. package/lib/DotProvider/utils/themeAppearanceAssetsConfig.js +69 -0
  141. package/lib/DotProvider/utils/themeColorAssetsConfig.js +249 -0
  142. package/lib/common/dot_boxShadow.module.css +0 -2
  143. package/lib/form/fields/CurrencyField/CurrencyField.js +2 -1
  144. package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +3 -5
  145. package/lib/list/DepartmentDropDown/DepartmentDropDown.js +3 -8
  146. package/lib/list/DepartmentDropDown/props/defaultProps.js +1 -2
  147. package/lib/list/DepartmentDropDown/props/propTypes.js +1 -1
  148. package/lib/list/status/StatusDropdown/StatusDropdown.js +8 -2
  149. package/lib/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +14 -0
  150. package/lib/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
  151. package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
  152. package/lib/list/status/StatusListItem/StatusListItem.module.css +5 -35
  153. package/lib/lookup/header/Search/LookupSearch.module.css +26 -26
  154. package/lib/lookup/header/Search/Search.js +73 -64
  155. package/lib/lookup/header/Search/props/defaultProps.js +2 -1
  156. package/lib/lookup/header/Search/props/propTypes.js +9 -3
  157. package/lib/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
  158. package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
  159. package/lib/v1/list/status/StatusDropdown/props/propTypes.js +1 -1
  160. package/package.json +6 -6
  161. package/result.json +1 -1
  162. package/unittest/index.html +6 -2
package/README.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  In this Library, we Provide Some Basic Components to Build Your Application
4
4
 
5
+ # 1.7.0
6
+
7
+ - **DotProvider** - Introduced `DotProvider` component.
8
+
9
+ # 1.6.2
10
+ - **CurrencyField**
11
+ - The focus action triggers only when the readonly property is set to false.
12
+
13
+ - **StatusDropdown**
14
+ - `renderTargetElement` and `renderFooterElement` props added
15
+
5
16
  # 1.6.1
6
17
 
7
18
  - **Image (v0&v1)**
@@ -0,0 +1,60 @@
1
+ import React, { useRef, useCallback, forwardRef } from "react";
2
+ import { defaultProps } from "./props/defaultProps";
3
+ import { propTypes } from "./props/propTypes";
4
+ import useDotProvider from "./hooks/useDotProvider";
5
+ const DotProvider = /*#__PURE__*/forwardRef((props, ref) => {
6
+ const {
7
+ tag: Element = 'div',
8
+ themeAppearance,
9
+ themeColor,
10
+ baseZoomUnit,
11
+ baseFontUnit,
12
+ zoomUnitVariable,
13
+ fontUnitVariable,
14
+ themeAppearanceAttr,
15
+ themeColorAttr,
16
+ providerRef,
17
+ onAssetsDownloadSuccess,
18
+ getAssetsPromises,
19
+ children,
20
+ ...rest
21
+ } = props;
22
+ const wrapperElementRef = useRef(null);
23
+ const getProviderElement = useCallback(() => {
24
+ if (typeof providerRef === 'function') {
25
+ return providerRef();
26
+ } else if (Element !== React.Fragment) {
27
+ return wrapperElementRef.current;
28
+ } else {
29
+ return document.documentElement;
30
+ }
31
+ }, [providerRef, Element]);
32
+ const getEleRef = useCallback(ele => {
33
+ wrapperElementRef.current = ele;
34
+
35
+ if (ref && typeof ref === 'function') {
36
+ ref(ele);
37
+ } else if (ref && typeof ref === 'object') {
38
+ ref.current = ele;
39
+ }
40
+ }, [ref]);
41
+ useDotProvider({
42
+ themeAppearance: themeAppearance,
43
+ themeColor: themeColor,
44
+ themeAppearanceAttr: themeAppearanceAttr,
45
+ themeColorAttr: themeColorAttr,
46
+ baseZoomUnit: baseZoomUnit,
47
+ baseFontUnit: baseFontUnit,
48
+ zoomUnitVariable: zoomUnitVariable,
49
+ fontUnitVariable: fontUnitVariable,
50
+ getProviderElement,
51
+ onAssetsDownloadSuccess: onAssetsDownloadSuccess,
52
+ getAssetsPromises: getAssetsPromises
53
+ });
54
+ return /*#__PURE__*/React.createElement(Element, { ...rest,
55
+ ref: getEleRef
56
+ }, children);
57
+ });
58
+ DotProvider.propTypes = propTypes;
59
+ DotProvider.defaultProps = defaultProps;
60
+ export default DotProvider;
@@ -0,0 +1,55 @@
1
+ import { useLayoutEffect } from 'react';
2
+ import useDownloadAssetsAndSetAttr from "./useDownloadAssetsAndSetAttr";
3
+ import '@zohodesk/components/assets/Contrast/lightContrastLightness.module.css';
4
+ import '@zohodesk/components/assets/Contrast/darkContrastLightness.module.css';
5
+ import '@zohodesk/components/assets/Contrast/pureDarkContrastLightness.module.css';
6
+ import '@zohodesk/variables/assets/colorVariables.module.css';
7
+ import '@zohodesk/variables/assets/dotVariables.module.css';
8
+ import '@zohodesk/components/es/common/basic.module.css';
9
+ import '@zohodesk/variables/lib/fontFamilyVariables.module.css';
10
+ import '@zohodesk/components/lib/common/boxShadow.module.css';
11
+ import "../../common/dot_boxShadow.module.css";
12
+
13
+ function useDotProvider(_ref) {
14
+ let {
15
+ themeAppearance,
16
+ themeColor,
17
+ baseZoomUnit,
18
+ baseFontUnit,
19
+ getProviderElement,
20
+ zoomUnitVariable,
21
+ fontUnitVariable,
22
+ themeAppearanceAttr,
23
+ themeColorAttr,
24
+ onAssetsDownloadSuccess,
25
+ getAssetsPromises
26
+ } = _ref;
27
+ const assetsPromises = useDownloadAssetsAndSetAttr({
28
+ themeAppearance,
29
+ themeColor,
30
+ baseZoomUnit,
31
+ baseFontUnit,
32
+ getProviderElement,
33
+ zoomUnitVariable,
34
+ fontUnitVariable,
35
+ themeAppearanceAttr,
36
+ themeColorAttr
37
+ });
38
+ const {
39
+ themeAppearancePromise,
40
+ themeColorPromise,
41
+ zoomSizePromise,
42
+ fontSizePromise
43
+ } = assetsPromises;
44
+ const allPromises = [...themeAppearancePromise, ...themeColorPromise, zoomSizePromise, fontSizePromise];
45
+ useLayoutEffect(() => {
46
+ Promise.all(allPromises).then(() => {
47
+ typeof onAssetsDownloadSuccess === 'function' && onAssetsDownloadSuccess();
48
+ }).catch(error => {
49
+ console.error('Error loading assets:', error);
50
+ });
51
+ typeof getAssetsPromises === 'function' && getAssetsPromises(assetsPromises);
52
+ }, [...allPromises]);
53
+ }
54
+
55
+ export default useDotProvider;
@@ -0,0 +1,97 @@
1
+ import { useMemo, useLayoutEffect } from 'react';
2
+ import { getThemeAppearanceAssetPromise } from "../utils/assetPromiseHandlers/themeAppearanceAssetPromise.js";
3
+ import { getThemeColorAssetPromise } from "../utils/assetPromiseHandlers/themeColorAssetPromise.js";
4
+ import { getFontSizeAssetPromise } from "../utils/assetPromiseHandlers/fontSizeAssetPromise.js";
5
+ import { getZoomSizeAssetPromise } from "../utils/assetPromiseHandlers/zoomSizeAssetPromise.js";
6
+ export default function useDownloadAssetsAndSetAttr(_ref) {
7
+ let {
8
+ themeAppearance,
9
+ themeColor,
10
+ baseZoomUnit,
11
+ baseFontUnit,
12
+ getProviderElement,
13
+ zoomUnitVariable,
14
+ fontUnitVariable,
15
+ themeAppearanceAttr,
16
+ themeColorAttr
17
+ } = _ref;
18
+ const themeAppearancePromise = useMemo(() => {
19
+ const themeAppearanceAssetPromise = getThemeAppearanceAssetPromise({
20
+ themeAppearance
21
+ });
22
+ return themeAppearanceAssetPromise;
23
+ }, [themeAppearance]);
24
+ const themeColorPromise = useMemo(() => {
25
+ const themeColorAssetPromise = getThemeColorAssetPromise({
26
+ themeAppearance,
27
+ themeColor
28
+ });
29
+ return themeColorAssetPromise;
30
+ }, [themeAppearance, themeColor]);
31
+ const modifiedZoomUnitWithSuffix = useMemo(() => {
32
+ return !isNaN(Number(baseZoomUnit)) ? `${Number(baseZoomUnit)}px` : baseZoomUnit;
33
+ }, [baseZoomUnit]);
34
+ const zoomSizePromise = useMemo(() => {
35
+ const assetPromise = getZoomSizeAssetPromise();
36
+ return assetPromise;
37
+ }, []);
38
+ const fontSizePromise = useMemo(() => {
39
+ const assetPromise = getFontSizeAssetPromise();
40
+ return assetPromise;
41
+ }, []);
42
+ const combinedPromise = {
43
+ themeAppearancePromise,
44
+ themeColorPromise,
45
+ zoomSizePromise,
46
+ fontSizePromise
47
+ };
48
+
49
+ function setThemeAttribute() {
50
+ const themePromise = [...themeAppearancePromise, ...themeColorPromise];
51
+ Promise.all(themePromise).then(() => {
52
+ const providerElement = getProviderElement();
53
+
54
+ if (providerElement) {
55
+ providerElement.setAttribute(themeAppearanceAttr, themeAppearance);
56
+ providerElement.setAttribute(themeColorAttr, themeColor);
57
+ }
58
+ }).catch(error => {
59
+ console.error('Error on setting theme appearance and color attributes:', error);
60
+ });
61
+ }
62
+
63
+ function setZoomSizeAttribute() {
64
+ zoomSizePromise.then(() => {
65
+ const providerElement = getProviderElement();
66
+
67
+ if (providerElement) {
68
+ providerElement.style.setProperty(zoomUnitVariable, modifiedZoomUnitWithSuffix);
69
+ }
70
+ }).catch(error => {
71
+ console.error('Error on setting zoom-size property', error);
72
+ });
73
+ }
74
+
75
+ function setFontSizeAttribute() {
76
+ fontSizePromise.then(() => {
77
+ const providerElement = getProviderElement();
78
+
79
+ if (providerElement) {
80
+ providerElement.style.setProperty(fontUnitVariable, baseFontUnit);
81
+ }
82
+ }).catch(error => {
83
+ console.error('Error on setting font-size property', error);
84
+ });
85
+ }
86
+
87
+ useLayoutEffect(() => {
88
+ setThemeAttribute();
89
+ }, [themeAppearanceAttr, themeColorAttr, themeAppearance, themeColor, getProviderElement]);
90
+ useLayoutEffect(() => {
91
+ setZoomSizeAttribute();
92
+ }, [zoomUnitVariable, modifiedZoomUnitWithSuffix, getProviderElement]);
93
+ useLayoutEffect(() => {
94
+ setFontSizeAttribute();
95
+ }, [fontUnitVariable, baseFontUnit, getProviderElement]);
96
+ return combinedPromise;
97
+ }
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/dark/themes/blue/blue_CTA_DarkTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/dark/themes/blue/blue_CTA_DarkModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/dark/themes/blue/blue_ComponentTheme_DarkTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/light/themes/blue/blue_CTA_LightTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/light/themes/blue/blue_CTA_LightModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/light/themes/blue/blue_ComponentTheme_LightTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/blue/blue_ComponentTheme_PureDarkTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/dark/themes/green/green_CTA_DarkTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/dark/themes/green/green_CTA_DarkModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/dark/themes/green/green_ComponentTheme_DarkTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/light/themes/green/green_CTA_LightTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/light/themes/green/green_CTA_LightModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/light/themes/green/green_ComponentTheme_LightTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/green/green_ComponentTheme_PureDarkTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/dark/themes/orange/orange_CTA_DarkTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/dark/themes/orange/orange_CTA_DarkModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/dark/themes/orange/orange_ComponentTheme_DarkTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/light/themes/orange/orange_CTA_LightTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/light/themes/orange/orange_CTA_LightModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/light/themes/orange/orange_ComponentTheme_LightTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/orange/orange_ComponentTheme_PureDarkTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/dark/themes/red/red_CTA_DarkTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/dark/themes/red/red_CTA_DarkModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/dark/themes/red/red_ComponentTheme_DarkTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/light/themes/red/red_CTA_LightTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/light/themes/red/red_CTA_LightModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/light/themes/red/red_ComponentTheme_LightTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/red/red_ComponentTheme_PureDarkTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/dark/themes/yellow/yellow_ComponentTheme_DarkTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/light/themes/yellow/yellow_CTA_LightTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/light/themes/yellow/yellow_CTA_LightModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/light/themes/yellow/yellow_ComponentTheme_LightTheme.module.css';
@@ -0,0 +1,3 @@
1
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkTheme.module.css';
2
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkModifyCategory.module.css';
3
+ import '@zohodesk/components/assets/Appearance/pureDark/themes/yellow/yellow_ComponentTheme_PureDarkTheme.module.css';
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/dark/themes/blue/blue_DotTheme_DarkTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/light/themes/blue/blue_DotTheme_LightTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/pureDark/themes/blue/blue_DotTheme_PureDarkTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/dark/themes/green/green_DotTheme_DarkTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/light/themes/green/green_DotTheme_LightTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/pureDark/themes/green/green_DotTheme_PureDarkTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/dark/themes/orange/orange_DotTheme_DarkTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/light/themes/orange/orange_DotTheme_LightTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/pureDark/themes/orange/orange_DotTheme_PureDarkTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/dark/themes/red/red_DotTheme_DarkTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/light/themes/red/red_DotTheme_LightTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/pureDark/themes/red/red_DotTheme_PureDarkTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/dark/themes/yellow/yellow_DotTheme_DarkTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/light/themes/yellow/yellow_DotTheme_LightTheme.module.css";
@@ -0,0 +1 @@
1
+ import "./../../../../../../assets/Appearance/pureDark/themes/yellow/yellow_DotTheme_PureDarkTheme.module.css";
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/dark/themes/blue/blue_SVGTheme_DarkTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/light/themes/blue/blue_SVGTheme_LightTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/pureDark/themes/blue/blue_SVGTheme_PureDarkTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/dark/themes/green/green_SVGTheme_DarkTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/light/themes/green/green_SVGTheme_LightTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/pureDark/themes/green/green_SVGTheme_PureDarkTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/dark/themes/orange/orange_SVGTheme_DarkTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/light/themes/orange/orange_SVGTheme_LightTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/pureDark/themes/orange/orange_SVGTheme_PureDarkTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/dark/themes/red/red_SVGTheme_DarkTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/light/themes/red/red_SVGTheme_LightTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/pureDark/themes/red/red_SVGTheme_PureDarkTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/dark/themes/yellow/yellow_SVGTheme_DarkTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/light/themes/yellow/yellow_SVGTheme_LightTheme.module.css';
@@ -0,0 +1 @@
1
+ import '@zohodesk/svg/assets/Appearance/pureDark/themes/yellow/yellow_SVGTheme_PureDarkTheme.module.css';
@@ -0,0 +1,11 @@
1
+ import { THEME_APPEARANCE_LIGHT, THEME_COLOR_BLUE } from "../utils/constants";
2
+ export const defaultProps = {
3
+ themeAppearance: THEME_APPEARANCE_LIGHT,
4
+ themeColor: THEME_COLOR_BLUE,
5
+ baseZoomUnit: '1px',
6
+ baseFontUnit: '16px',
7
+ zoomUnitVariable: '--zd_baseUnit',
8
+ fontUnitVariable: '--zd_baseFontUnit',
9
+ themeAppearanceAttr: 'data-mode',
10
+ themeColorAttr: 'data-theme'
11
+ };
@@ -0,0 +1,16 @@
1
+ import PropTypes from 'prop-types';
2
+ import { THEME_APPEARANCES, THEME_COLORS } from "../utils/constants";
3
+ export const propTypes = {
4
+ themeAppearance: PropTypes.oneOf(THEME_APPEARANCES),
5
+ themeColor: PropTypes.oneOf(THEME_COLORS),
6
+ baseZoomUnit: PropTypes.string,
7
+ baseFontUnit: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
8
+ zoomUnitVariable: PropTypes.string,
9
+ fontUnitVariable: PropTypes.string,
10
+ themeAppearanceAttr: PropTypes.string,
11
+ themeColorAttr: PropTypes.string,
12
+ providerRef: PropTypes.func,
13
+ onAssetsDownloadSuccess: PropTypes.func,
14
+ getAssetsPromises: PropTypes.func,
15
+ children: PropTypes.node
16
+ };
@@ -0,0 +1,4 @@
1
+ import { sizeImports, sizeMapping } from "../sizeAssetsConfig";
2
+ export function getFontSizeAssetPromise() {
3
+ return sizeImports[sizeMapping.fontSize]();
4
+ }
@@ -0,0 +1,28 @@
1
+ import { getAssetsImportPromises } from "../getAssetsImportPromises";
2
+ import { themeAppearanceImports, themeAppearanceMapping } from "../themeAppearanceAssetsConfig";
3
+ import { validateAndLogError } from "../errorValidation";
4
+ import { LIBRARIES, THEME_APPEARANCES } from "../constants";
5
+ export function getThemeAppearanceAssetPromise(_ref) {
6
+ let {
7
+ themeAppearance
8
+ } = _ref;
9
+ const isError = validateAndLogError({
10
+ options: THEME_APPEARANCES,
11
+ value: themeAppearance,
12
+ type: 'themeAppearance'
13
+ });
14
+
15
+ if (!isError) {
16
+ const assetImportKeys = [];
17
+ LIBRARIES.map(library => {
18
+ const assetImportKey = themeAppearanceMapping[library][themeAppearance];
19
+ assetImportKeys.push(assetImportKey);
20
+ });
21
+ return getAssetsImportPromises({
22
+ assetImportKeys: assetImportKeys,
23
+ assetImports: themeAppearanceImports
24
+ });
25
+ }
26
+
27
+ return [];
28
+ }
@@ -0,0 +1,29 @@
1
+ import { getAssetsImportPromises } from "../getAssetsImportPromises";
2
+ import { themeColorImports, themeColorMapping } from "../themeColorAssetsConfig";
3
+ import { validateAndLogError } from "../errorValidation";
4
+ import { LIBRARIES, THEME_COLORS } from "../constants";
5
+ export function getThemeColorAssetPromise(_ref) {
6
+ let {
7
+ themeAppearance,
8
+ themeColor
9
+ } = _ref;
10
+ const isError = validateAndLogError({
11
+ options: THEME_COLORS,
12
+ value: themeColor,
13
+ type: 'themeColor'
14
+ });
15
+
16
+ if (!isError) {
17
+ const assetImportKeys = [];
18
+ LIBRARIES.map(library => {
19
+ const assetImportKey = themeColorMapping[library][themeColor][themeAppearance];
20
+ assetImportKeys.push(assetImportKey);
21
+ });
22
+ return getAssetsImportPromises({
23
+ assetImportKeys: assetImportKeys,
24
+ assetImports: themeColorImports
25
+ });
26
+ }
27
+
28
+ return [];
29
+ }
@@ -0,0 +1,4 @@
1
+ import { sizeImports, sizeMapping } from "../sizeAssetsConfig";
2
+ export function getZoomSizeAssetPromise() {
3
+ return sizeImports[sizeMapping.zoomSize]();
4
+ }
@@ -0,0 +1,14 @@
1
+ export const LIBRARY_COMPONENT = 'component';
2
+ export const LIBRARY_DOT = 'dot';
3
+ export const LIBRARY_SVG = 'svg';
4
+ export const THEME_APPEARANCE_LIGHT = 'light';
5
+ export const THEME_APPEARANCE_DARK = 'dark';
6
+ export const THEME_APPEARANCE_PURE_DARK = 'pureDark';
7
+ export const THEME_COLOR_BLUE = 'blue';
8
+ export const THEME_COLOR_GREEN = 'green';
9
+ export const THEME_COLOR_ORANGE = 'orange';
10
+ export const THEME_COLOR_RED = 'red';
11
+ export const THEME_COLOR_YELLOW = 'yellow';
12
+ export const LIBRARIES = [LIBRARY_COMPONENT, LIBRARY_DOT, LIBRARY_SVG];
13
+ export const THEME_APPEARANCES = [THEME_APPEARANCE_LIGHT, THEME_APPEARANCE_DARK, THEME_APPEARANCE_PURE_DARK];
14
+ export const THEME_COLORS = [THEME_COLOR_BLUE, THEME_COLOR_GREEN, THEME_COLOR_ORANGE, THEME_COLOR_RED, THEME_COLOR_YELLOW];
@@ -0,0 +1,17 @@
1
+ import { THEME_APPEARANCES, THEME_COLORS } from "./constants";
2
+ export function validateAndLogError(_ref) {
3
+ let {
4
+ options,
5
+ value,
6
+ type
7
+ } = _ref;
8
+ let isError = !options.includes(value);
9
+
10
+ if (isError) {
11
+ const themeAppearances = THEME_APPEARANCES.toString();
12
+ const themeColors = THEME_COLORS.toString();
13
+ console.error(`We do not support the '${value} ${type}'. Please provide valid '${type}' values or check spelling. DotProvider supports ${themeAppearances} appearance & ${themeColors} theme.`);
14
+ }
15
+
16
+ return isError;
17
+ }
@@ -0,0 +1,17 @@
1
+ export function getAssetsImportPromises(_ref) {
2
+ let {
3
+ assetImportKeys,
4
+ assetImports
5
+ } = _ref;
6
+ const promises = [];
7
+ assetImportKeys.forEach(importKey => {
8
+ const assetURL = assetImports[importKey];
9
+
10
+ if (assetURL) {
11
+ promises.push(assetURL());
12
+ } else {
13
+ console.error(`Import not found for ${importKey} from ${assetImports}`);
14
+ }
15
+ });
16
+ return promises;
17
+ }
@@ -0,0 +1,12 @@
1
+ export const sizeImports = {
2
+ Lib_ZoomSize: () => import(
3
+ /* webpackChunkName: 'Lib_ZoomSize' */
4
+ '@zohodesk/variables/assets/sizeVariables.module.css'),
5
+ Lib_FontSize: () => import(
6
+ /* webpackChunkName: 'Lib_FontSize' */
7
+ '@zohodesk/variables/assets/fontsizeVariables.module.css')
8
+ };
9
+ export const sizeMapping = {
10
+ zoomSize: 'Lib_ZoomSize',
11
+ fontSize: 'Lib_FontSize'
12
+ };