diginet-core-ui 1.3.78 → 1.3.79

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 (209) hide show
  1. package/components/accordion/details.js +2 -6
  2. package/components/accordion/group.js +2 -9
  3. package/components/accordion/index.js +2 -15
  4. package/components/accordion/summary.js +4 -27
  5. package/components/alert/index.js +98 -137
  6. package/components/alert/notify.js +97 -166
  7. package/components/avatar/index.js +4 -63
  8. package/components/badge/index.js +7 -34
  9. package/components/button/icon.js +120 -186
  10. package/components/button/index.js +136 -205
  11. package/components/button/more.js +0 -12
  12. package/components/button/ripple-effect.js +46 -44
  13. package/components/card/body.js +2 -7
  14. package/components/card/extra.js +2 -7
  15. package/components/card/footer.js +2 -7
  16. package/components/card/header.js +2 -7
  17. package/components/card/index.js +2 -22
  18. package/components/chart/Pie/Circle.js +0 -1
  19. package/components/chart/Pie/Sector.js +0 -17
  20. package/components/chart/Pie/Sectors.js +0 -10
  21. package/components/chart/Pie/index.js +4 -36
  22. package/components/chart/Pie-v2/Circle.js +0 -1
  23. package/components/chart/Pie-v2/Sector.js +0 -13
  24. package/components/chart/Pie-v2/Sectors.js +0 -20
  25. package/components/chart/Pie-v2/index.js +11 -38
  26. package/components/chart/bar/Axis.js +0 -12
  27. package/components/chart/bar/Bar.js +13 -35
  28. package/components/chart/bar/Grid.js +0 -18
  29. package/components/chart/bar/Labels.js +0 -18
  30. package/components/chart/bar/Points.js +0 -17
  31. package/components/chart/bar/index.js +6 -26
  32. package/components/chart/bar-v2/Axis.js +0 -12
  33. package/components/chart/bar-v2/Bar.js +15 -36
  34. package/components/chart/bar-v2/Grid.js +0 -18
  35. package/components/chart/bar-v2/Labels.js +0 -18
  36. package/components/chart/bar-v2/Points.js +0 -17
  37. package/components/chart/bar-v2/index.js +6 -26
  38. package/components/chart/line/Axis.js +4 -16
  39. package/components/chart/line/Grid.js +2 -19
  40. package/components/chart/line/Labels.js +0 -18
  41. package/components/chart/line/Path.js +23 -33
  42. package/components/chart/line/Point.js +6 -40
  43. package/components/chart/line/Title.js +0 -3
  44. package/components/chart/line/index.js +12 -35
  45. package/components/chart/line-v2/Axis.js +0 -13
  46. package/components/chart/line-v2/Grid.js +0 -18
  47. package/components/chart/line-v2/Labels.js +0 -18
  48. package/components/chart/line-v2/Path.js +23 -33
  49. package/components/chart/line-v2/Point.js +6 -35
  50. package/components/chart/line-v2/Title.js +0 -3
  51. package/components/chart/line-v2/index.js +12 -30
  52. package/components/check-text/index.js +0 -8
  53. package/components/check-text/interview-confirmation.js +0 -7
  54. package/components/check-text/interview-status.js +0 -7
  55. package/components/chip/attach.js +4 -17
  56. package/components/chip/index.js +6 -33
  57. package/components/collapse/index.js +0 -13
  58. package/components/divider/index.js +0 -8
  59. package/components/form-control/attachment/index.js +24 -202
  60. package/components/form-control/calendar/function.js +40 -94
  61. package/components/form-control/calendar/index.js +5 -30
  62. package/components/form-control/calendar/range.js +11 -28
  63. package/components/form-control/checkbox/index.js +4 -37
  64. package/components/form-control/control/index.js +3 -13
  65. package/components/form-control/date-picker/index-old.js +18 -0
  66. package/components/form-control/date-picker/index.js +23 -99
  67. package/components/form-control/date-range-picker/index.js +86 -221
  68. package/components/form-control/dropdown/index.js +72 -289
  69. package/components/form-control/dropdown-box/index.js +6 -35
  70. package/components/form-control/form/index.js +0 -2
  71. package/components/form-control/form-group/index.js +1 -6
  72. package/components/form-control/helper-text/index.js +2 -9
  73. package/components/form-control/input-base/index.js +218 -399
  74. package/components/form-control/label/index.js +2 -12
  75. package/components/form-control/money-input/index.js +43 -132
  76. package/components/form-control/number-input/index.js +15 -113
  77. package/components/form-control/number-input/index2.js +78 -119
  78. package/components/form-control/phone-input/index.js +16 -78
  79. package/components/form-control/radio/index.js +4 -23
  80. package/components/form-control/text-input/index.js +33 -256
  81. package/components/form-control/time-picker/index.js +14 -71
  82. package/components/form-control/time-picker/swiper.js +21 -73
  83. package/components/form-control/toggle/index.js +4 -19
  84. package/components/form-view/helper-text.js +2 -2
  85. package/components/form-view/index.js +0 -14
  86. package/components/form-view/input.js +2 -13
  87. package/components/form-view/label.js +0 -2
  88. package/components/grid/Col.js +2 -15
  89. package/components/grid/Container.js +2 -21
  90. package/components/grid/Row.js +2 -21
  91. package/components/grid/index.js +2 -43
  92. package/components/image/index.js +2 -22
  93. package/components/index.js +62 -31
  94. package/components/list/list-item-action.js +0 -9
  95. package/components/list/list-item-icon.js +0 -9
  96. package/components/list/list-item-text.js +0 -5
  97. package/components/list/list-item.js +0 -11
  98. package/components/list/list.js +0 -13
  99. package/components/list/sub-header.js +0 -4
  100. package/components/modal/body.js +2 -6
  101. package/components/modal/footer.js +2 -11
  102. package/components/modal/header.js +2 -12
  103. package/components/modal/index.js +2 -10
  104. package/components/modal/modal.js +11 -52
  105. package/components/others/extra/index.js +3 -10
  106. package/components/others/import/index.js +0 -7
  107. package/components/others/option-wrapper/index.js +4 -7
  108. package/components/others/scrollbar/index.js +0 -3
  109. package/components/paging/page-info.js +39 -101
  110. package/components/paging/page-selector.js +7 -35
  111. package/components/paging/page-selector2.js +35 -74
  112. package/components/paper/index.js +0 -11
  113. package/components/popover/body.js +2 -6
  114. package/components/popover/footer.js +2 -11
  115. package/components/popover/header.js +2 -7
  116. package/components/popover/index.js +39 -123
  117. package/components/popup/danger_popup.js +0 -19
  118. package/components/popup/index.js +2 -48
  119. package/components/popup/proposals_popup.js +10 -49
  120. package/components/popup/v2/index.js +0 -31
  121. package/components/progress/circular.js +19 -81
  122. package/components/progress/linear.js +4 -20
  123. package/components/rating/index.js +0 -24
  124. package/components/slider/slider-container.js +3 -40
  125. package/components/slider/slider-item.js +10 -25
  126. package/components/status/index.js +2 -16
  127. package/components/tab/tab-container.js +2 -16
  128. package/components/tab/tab-header.js +4 -24
  129. package/components/tab/tab-panel.js +4 -16
  130. package/components/tab/tab.js +4 -28
  131. package/components/tooltip/index.js +12 -97
  132. package/components/tooltip/portal.js +0 -2
  133. package/components/transfer/index.js +22 -67
  134. package/components/tree-view/index.js +62 -202
  135. package/components/typography/index.js +3 -31
  136. package/global/index.js +0 -8
  137. package/icons/basic.js +0 -48
  138. package/icons/effect.js +17 -29
  139. package/icons/general/clock/clock.js +0 -2
  140. package/icons/general/color-handler/background.js +0 -2
  141. package/icons/general/color-handler/text.js +0 -2
  142. package/icons/general/emoji/emoji.js +0 -2
  143. package/icons/general/font-properties/bold.js +0 -2
  144. package/icons/general/font-properties/font-family.js +0 -2
  145. package/icons/general/font-properties/font-size.js +0 -2
  146. package/icons/general/font-properties/italic.js +0 -2
  147. package/icons/general/font-properties/underline.js +0 -2
  148. package/icons/general/hyperlink/hyperlink.js +0 -2
  149. package/icons/general/indent/decrease.js +0 -2
  150. package/icons/general/indent/increase.js +0 -2
  151. package/icons/general/list/bullets.js +0 -2
  152. package/icons/general/list/numbering.js +0 -2
  153. package/icons/general/picture/picture.js +0 -2
  154. package/icons/general/steps/redo.js +0 -2
  155. package/icons/general/steps/undo.js +0 -2
  156. package/icons/general/text-align/center.js +0 -2
  157. package/icons/general/text-align/justify.js +0 -2
  158. package/icons/general/text-align/left.js +0 -2
  159. package/icons/general/text-align/right.js +0 -2
  160. package/icons/menu/dhr.js +2 -1
  161. package/icons/menu/index.js +2 -2
  162. package/icons/menu/v2/index.js +0 -10
  163. package/package.json +1 -1
  164. package/readme.md +11 -1
  165. package/styles/animation.js +15 -58
  166. package/styles/color-helper.js +24 -54
  167. package/styles/colors.js +17 -9
  168. package/styles/general.js +6 -2
  169. package/styles/typography.js +4 -4
  170. package/styles/utils.js +2 -2
  171. package/theme/createBreakpoints.js +7 -18
  172. package/theme/make-styles.js +2 -5
  173. package/theme/set-theme.js +3 -6
  174. package/theme/settings.js +3 -2
  175. package/theme/theme-provider.js +0 -1
  176. package/utils/array/array.js +14 -23
  177. package/utils/classNames.js +0 -5
  178. package/utils/console.js +0 -6
  179. package/utils/date.js +13 -82
  180. package/utils/error/error.js +1 -9
  181. package/utils/error/errors.js +1 -48
  182. package/utils/getFileType.js +0 -9
  183. package/utils/handleBreakpoints.js +0 -5
  184. package/utils/intersectionObserver.js +0 -5
  185. package/utils/iterator.js +0 -9
  186. package/utils/map-parent.js +3 -10
  187. package/utils/object/extend.js +0 -10
  188. package/utils/object/object.js +12 -11
  189. package/utils/parseHTML.js +0 -1
  190. package/utils/promisify.js +0 -5
  191. package/utils/randomString.js +0 -7
  192. package/utils/remove-unicode.js +0 -1
  193. package/utils/render-portal.js +1 -9
  194. package/utils/renderHTML.js +4 -6
  195. package/utils/renderIcon.js +4 -14
  196. package/utils/sb-template.js +6 -5
  197. package/utils/string/capitalize.js +0 -1
  198. package/utils/string/capitalizeSentenceCase.js +0 -2
  199. package/utils/string/string.js +0 -13
  200. package/utils/type.js +0 -21
  201. package/utils/updatePosition.js +4 -5
  202. package/utils/useDelayUnmount.js +0 -4
  203. package/utils/useElementSize.js +9 -3
  204. package/utils/useEventListener.js +12 -6
  205. package/utils/useInput.js +0 -6
  206. package/utils/useMediaQuery.js +8 -10
  207. package/utils/useOnClickOutside.js +0 -2
  208. package/utils/usePortal.js +3 -10
  209. package/utils/validate.js +6 -20
@@ -1,59 +1,37 @@
1
1
  /* eslint-disable react/prop-types */
2
-
3
2
  /** @jsxRuntime classic */
4
-
5
3
  /** @jsx jsx */
6
- import { jsx, css } from '@emotion/core';
7
- import React, { useLayoutEffect, useState } from 'react';
8
-
4
+ import { css, jsx, keyframes } from '@emotion/core';
5
+ import { forwardRef, memo, useImperativeHandle, useLayoutEffect, useState } from 'react';
6
+ import { borderRadius100, borderRadius50, overflowHidden, positionAbsolute } from '../../styles/general';
7
+ import { useTheme } from '../../theme';
8
+ const {
9
+ colors: {
10
+ system: {
11
+ white: systemWhite
12
+ }
13
+ }
14
+ } = useTheme();
9
15
  const useDebouncedRippleCleanUp = (rippleCount, duration, cleanUpFunction) => {
10
16
  useLayoutEffect(() => {
11
17
  if (rippleCount > 0) {
12
18
  const bounce = setTimeout(() => cleanUpFunction(), duration);
13
19
  return () => clearTimeout(bounce);
14
20
  }
15
-
16
21
  return undefined;
17
22
  }, [rippleCount, duration, cleanUpFunction]);
18
23
  };
19
-
20
- const Ripple = ({
24
+ const Ripple = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
21
25
  duration = 850,
22
- color = '#fff',
26
+ color = systemWhite,
23
27
  circular = false,
24
28
  ...props
25
- }) => {
29
+ }, ref) => {
26
30
  const [rippleArray, setRippleArray] = useState([]);
27
31
  useDebouncedRippleCleanUp(rippleArray.length, duration, () => {
28
32
  setRippleArray([]);
29
33
  });
30
- const RippleContainer = css`
31
- position: absolute;
32
- overflow: hidden;
33
- top: 0;
34
- right: 0;
35
- bottom: 0;
36
- left: 0;
37
- ${circular && 'border-radius: 50%;'}
38
-
39
- span {
40
- transform: scale(0);
41
- border-radius: 100%;
42
- position: absolute;
43
- opacity: 0.75;
44
- background-color: ${color};
45
- animation-name: ripple;
46
- animation-duration: ${duration}ms;
47
- }
48
-
49
- @keyframes ripple {
50
- to {
51
- opacity: 0;
52
- transform: scale(2);
53
- }
54
- }
55
- `;
56
-
34
+ const _RippleChildCSS = RippleChildCSS(circular, color, duration);
57
35
  const addRipple = event => {
58
36
  const rippleContainer = event.currentTarget.getBoundingClientRect();
59
37
  const size = rippleContainer.width > rippleContainer.height ? rippleContainer.width : rippleContainer.height;
@@ -66,14 +44,18 @@ const Ripple = ({
66
44
  };
67
45
  setRippleArray(prevState => [...prevState, newRippleArray]);
68
46
  };
69
-
47
+ useImperativeHandle(ref, () => ({
48
+ start: addRipple
49
+ }));
70
50
  return jsx("span", {
71
- css: RippleContainer,
72
- ...props,
73
- onMouseDown: addRipple
51
+ css: RippleContainerCSS,
52
+ className: 'DGN-UI-Ripple',
53
+ ...props
74
54
  }, rippleArray.length > 0 && rippleArray.map((ripple, index) => {
75
55
  return jsx("span", {
76
56
  key: 'ripple_' + index,
57
+ css: _RippleChildCSS,
58
+ className: 'DGN-UI-Ripple-Child',
77
59
  style: {
78
60
  top: ripple.y,
79
61
  left: ripple.x,
@@ -82,6 +64,26 @@ const Ripple = ({
82
64
  }
83
65
  });
84
66
  }));
85
- };
86
-
87
- export default /*#__PURE__*/React.memo(Ripple);
67
+ }));
68
+ const rippleKeyframes = keyframes`
69
+ to {
70
+ opacity: 0;
71
+ transform: scale(2);
72
+ }
73
+ `;
74
+ const RippleContainerCSS = css`
75
+ ${overflowHidden};
76
+ ${positionAbsolute};
77
+ z-index: 0;
78
+ inset: 0px;
79
+ border-radius: inherit;
80
+ `;
81
+ const RippleChildCSS = (circular, color, duration) => css`
82
+ ${positionAbsolute};
83
+ ${circular ? borderRadius50 : borderRadius100};
84
+ opacity: 0.75;
85
+ transform: scale(0);
86
+ background-color: ${color};
87
+ animation: ${rippleKeyframes} ${duration}ms;
88
+ `;
89
+ export default Ripple;
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -18,11 +17,10 @@ const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
18
17
  useImperativeHandle(reference, () => {
19
18
  const currentRef = ref.current || {};
20
19
  currentRef.element = ref.current;
21
- const _instance = { ...action
20
+ const _instance = {
21
+ ...action
22
22
  }; // methods
23
-
24
23
  _instance.__proto__ = {}; // hidden methods
25
-
26
24
  currentRef.instance = _instance;
27
25
  return currentRef;
28
26
  });
@@ -42,13 +40,10 @@ CardBody.defaultProps = {
42
40
  CardBody.propTypes = {
43
41
  /** The content of the component. */
44
42
  children: PropTypes.node,
45
-
46
43
  /** Class for component. ({container: '', header: '', body: '', footer: ''}) */
47
44
  className: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
48
-
49
45
  /** If `true`, will have divider between body and footer. */
50
46
  style: PropTypes.object,
51
-
52
47
  /** The title of the component's header. */
53
48
  title: PropTypes.string
54
49
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -18,11 +17,10 @@ const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
18
17
  useImperativeHandle(reference, () => {
19
18
  const currentRef = ref.current || {};
20
19
  currentRef.element = ref.current;
21
- const _instance = { ...action
20
+ const _instance = {
21
+ ...action
22
22
  }; // methods
23
-
24
23
  _instance.__proto__ = {}; // hidden methods
25
-
26
24
  currentRef.instance = _instance;
27
25
  return currentRef;
28
26
  });
@@ -42,13 +40,10 @@ CardExtra.defaultProps = {
42
40
  CardExtra.propTypes = {
43
41
  /** The content of the component. */
44
42
  children: PropTypes.node,
45
-
46
43
  /** Class for component. ({container: '', header: '', body: '', footer: ''}) */
47
44
  className: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
48
-
49
45
  /** If `true`, will have divider between body and footer. */
50
46
  style: PropTypes.object,
51
-
52
47
  /** The title of the component's header. */
53
48
  title: PropTypes.string
54
49
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -18,11 +17,10 @@ const CardFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
18
17
  useImperativeHandle(reference, () => {
19
18
  const currentRef = ref.current || {};
20
19
  currentRef.element = ref.current;
21
- const _instance = { ...action
20
+ const _instance = {
21
+ ...action
22
22
  }; // methods
23
-
24
23
  _instance.__proto__ = {}; // hidden methods
25
-
26
24
  currentRef.instance = _instance;
27
25
  return currentRef;
28
26
  });
@@ -42,13 +40,10 @@ CardFooter.defaultProps = {
42
40
  CardFooter.propTypes = {
43
41
  /** The content of the component. */
44
42
  children: PropTypes.node,
45
-
46
43
  /** Class for component. ({container: '', header: '', body: '', footer: ''}) */
47
44
  className: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
48
-
49
45
  /** If `true`, will have divider between body and footer. */
50
46
  style: PropTypes.object,
51
-
52
47
  /** The title of the component's header. */
53
48
  title: PropTypes.string
54
49
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -19,11 +18,10 @@ const CardHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
19
18
  useImperativeHandle(reference, () => {
20
19
  const currentRef = ref.current || {};
21
20
  currentRef.element = ref.current;
22
- const _instance = { ...action
21
+ const _instance = {
22
+ ...action
23
23
  }; // methods
24
-
25
24
  _instance.__proto__ = {}; // hidden methods
26
-
27
25
  currentRef.instance = _instance;
28
26
  return currentRef;
29
27
  });
@@ -45,13 +43,10 @@ CardHeader.defaultProps = {
45
43
  CardHeader.propTypes = {
46
44
  /** The content of the component. */
47
45
  children: PropTypes.node,
48
-
49
46
  /** Class for component. ({container: '', header: '', body: '', footer: ''}) */
50
47
  className: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
51
-
52
48
  /** If `true`, will have divider between body and footer. */
53
49
  style: PropTypes.object,
54
-
55
50
  /** The title of the component's header. */
56
51
  title: PropTypes.string
57
52
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -44,17 +43,14 @@ const Card = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
44
43
  width
45
44
  }, reference) => {
46
45
  const ref = useRef(null);
47
-
48
46
  const _CardCSS = CardCSS(width, height, headerDivider, footerDivider, dividerColor, direction);
49
-
50
47
  useImperativeHandle(reference, () => {
51
48
  const currentRef = ref.current || {};
52
49
  currentRef.element = ref.current;
53
- const _instance = { ...action
50
+ const _instance = {
51
+ ...action
54
52
  }; // methods
55
-
56
53
  _instance.__proto__ = {}; // hidden methods
57
-
58
54
  currentRef.instance = _instance;
59
55
  return currentRef;
60
56
  });
@@ -81,7 +77,6 @@ const Card = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
81
77
  }, head, body || children, foot);
82
78
  }, [bodyProp, bodyStyle, children, className, dividerColor, direction, footer, footerDivider, footerStyle, header, headerDivider, headerStyle, height, id, style, title, width]);
83
79
  }));
84
-
85
80
  const CardCSS = (width, height, headerDivider, footerDivider, dividerColor, direction) => css`
86
81
  ${direction === 'vertical' ? flexCol : flexRow};
87
82
  ${positionRelative};
@@ -137,7 +132,6 @@ const CardCSS = (width, height, headerDivider, footerDivider, dividerColor, dire
137
132
  ${borderBox};
138
133
  }
139
134
  `;
140
-
141
135
  Card.defaultProps = {
142
136
  bodyStyle: {},
143
137
  className: '',
@@ -152,46 +146,32 @@ Card.defaultProps = {
152
146
  Card.propTypes = {
153
147
  /** The content of the component's body. */
154
148
  body: PropTypes.node,
155
-
156
149
  /** The content of the component's body. */
157
150
  bodyStyle: PropTypes.object,
158
-
159
151
  /** The content of the component. */
160
152
  children: PropTypes.node,
161
-
162
153
  /** Class for component. ({container: '', header: '', body: '', footer: ''}) */
163
154
  className: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
164
-
165
155
  /** Color of divider. */
166
156
  dividerColor: PropTypes.string,
167
-
168
157
  /** The content of the component's footer. */
169
158
  footer: PropTypes.node,
170
-
171
159
  /** If `true`, will have divider between body and footer. */
172
160
  footerDivider: PropTypes.bool,
173
-
174
161
  /** Style inline of component's footer. */
175
162
  footerStyle: PropTypes.object,
176
-
177
163
  /** The content of the component's header. */
178
164
  header: PropTypes.node,
179
-
180
165
  /** If `true`, will have divider between header and body. */
181
166
  headerDivider: PropTypes.bool,
182
-
183
167
  /** Style inline of component's header. */
184
168
  headerStyle: PropTypes.object,
185
-
186
169
  /** Height of the component. */
187
170
  height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
188
-
189
171
  /** Style inline of component. */
190
172
  style: PropTypes.object,
191
-
192
173
  /** The title of the component's header. */
193
174
  title: PropTypes.string,
194
-
195
175
  /** Width of the component. */
196
176
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
197
177
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import PropTypes from 'prop-types';
5
4
  import { memo, forwardRef } from 'react';
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { useRef, memo, forwardRef } from 'react';
5
4
  import PropTypes from "prop-types";
@@ -27,11 +26,9 @@ const Sector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
27
26
  ...props
28
27
  }, ref) => {
29
28
  let result;
30
-
31
29
  if (!ref) {
32
30
  ref = useRef(null);
33
31
  }
34
-
35
32
  const pathRef = useRef(null);
36
33
  const SectorCSS = expandOnHover || expandedIndex >= 0 ? css`
37
34
  transition-property: all;
@@ -48,10 +45,8 @@ const Sector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
48
45
  transition-timing-function: ${transitionTimingFunction};
49
46
  transition-duration: ${transitionDuration};
50
47
  `;
51
-
52
48
  const Data = (data, index) => {
53
49
  let item = null;
54
-
55
50
  if (renderSelectedItem && typeof renderSelectedItem === 'function') {
56
51
  item = renderSelectedItem({
57
52
  data,
@@ -61,7 +56,6 @@ const Sector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
61
56
  ReactDOM.render(item, pathRef.current.appendChild(el));
62
57
  }
63
58
  };
64
-
65
59
  const content = jsx("g", {
66
60
  css: SectorCSS
67
61
  }, jsx("path", {
@@ -78,7 +72,6 @@ const Sector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
78
72
  onMouseLeave: onMouseLeave,
79
73
  ...props
80
74
  }, renderSelectedItem ? Data() : name && jsx("title", null, name, ": ", quantity)));
81
-
82
75
  if (href) {
83
76
  result = jsx("a", {
84
77
  href: href
@@ -86,7 +79,6 @@ const Sector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
86
79
  } else {
87
80
  result = content;
88
81
  }
89
-
90
82
  return result;
91
83
  }));
92
84
  Sector.defaultProps = {
@@ -102,38 +94,29 @@ Sector.defaultProps = {
102
94
  Sector.propTypes = {
103
95
  /** the fill change color of pie chart */
104
96
  fill: PropTypes.string.isRequired,
105
-
106
97
  /** event click mouse in pie chart */
107
98
  onMouseEnter: PropTypes.func,
108
-
109
99
  /** event leave mouse in pie chart */
110
100
  onMouseLeave: PropTypes.func,
111
101
  onTouchEnd: PropTypes.func,
112
102
  onTouchStart: PropTypes.func,
113
-
114
103
  /** function displays selected items by custom, example:<br/>
115
104
  * renderItem={(data, index) => index + ' - ' + data.name}<br/>
116
105
  */
117
106
  renderSelectedItem: PropTypes.func,
118
107
  path: PropTypes.string.isRequired,
119
-
120
108
  /** the StrokeColor change color border and Stroke */
121
109
  strokeColor: PropTypes.string,
122
-
123
110
  /** it can be applied to any element but it has effect only on the following nine */
124
111
  strokeLinejoin: PropTypes.string,
125
-
126
112
  /** The strokeWidth attribute is a presentation attribute defining the width of the stroke to be applied to the shape */
127
113
  strokeWidth: PropTypes.number,
128
-
129
114
  /** The title is add from the data */
130
115
  name: PropTypes.string,
131
116
  quantity: PropTypes.number,
132
117
  href: PropTypes.string,
133
-
134
118
  /** The transition-duration CSS property sets the length of time a transition animation should take to complete. Default 0.3s */
135
119
  transitionDuration: PropTypes.string,
136
-
137
120
  /** The transition-timing-function CSS property sets how intermediate values are calculated for CSS properties being affected*/
138
121
  transitionTimingFunction: PropTypes.string,
139
122
  className: PropTypes.string
@@ -1,10 +1,8 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import PropTypes from "prop-types";
5
4
  import Sector from "./Sector";
6
5
  import { jsx } from '@emotion/core';
7
-
8
6
  const Sectors = ({
9
7
  center,
10
8
  data,
@@ -56,35 +54,27 @@ const Sectors = ({
56
54
  });
57
55
  })) : null;
58
56
  };
59
-
60
57
  Sectors.defaultProps = {
61
58
  expandSize: 2
62
59
  };
63
60
  Sectors.propTypes = {
64
61
  center: PropTypes.number.isRequired,
65
-
66
62
  /** The array of elements that appear in the PieChart */
67
63
  data: PropTypes.arrayOf(PropTypes.shape({
68
64
  color: PropTypes.string.isRequired,
69
65
  name: PropTypes.string,
70
66
  quantity: PropTypes.number.isRequired
71
67
  })).isRequired,
72
-
73
68
  /** returns the data of the object to be hover */
74
69
  onSectorHover: PropTypes.func,
75
-
76
70
  /** the Size expand On Hover */
77
71
  expandSize: PropTypes.number,
78
-
79
72
  /** the StrokeWidth change color border and Stroke */
80
73
  strokeColor: Sector.propTypes.strokeColor,
81
-
82
74
  /** The strokeWidth attribute is a presentation attribute defining the width of the stroke to be applied to the shape */
83
75
  strokeWidth: Sector.propTypes.strokeWidth,
84
-
85
76
  /** The starting angle is drawn in a circle from data first */
86
77
  startAngle: PropTypes.number,
87
-
88
78
  /** */
89
79
  angleMargin: PropTypes.number
90
80
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { useState, useRef, useEffect, memo, forwardRef } from 'react';
5
4
  import PropTypes from "prop-types";
@@ -26,29 +25,23 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
26
25
  if (!ref) {
27
26
  ref = useRef(null);
28
27
  }
29
-
30
28
  if (data[0] && !data[0].color) {
31
29
  var colors = [];
32
30
  let Count = data.length;
33
-
34
31
  while (colors.length < Count) {
35
32
  do {
36
33
  var makeColorCode = '0123456789ABCDEF';
37
34
  var code = '#';
38
-
39
35
  for (var count = 0; count < 6; count++) {
40
36
  code = code + makeColorCode[Math.floor(Math.random() * 16)];
41
37
  }
42
38
  } while (colors.indexOf(code) >= 0);
43
-
44
39
  colors.push("#" + ("000000" + code.toString(16)).slice(-6));
45
40
  }
46
-
47
41
  for (let i in data) {
48
42
  data[i].color = colors[i];
49
43
  }
50
44
  }
51
-
52
45
  const compare = () => {
53
46
  if (width > height) {
54
47
  return height;
@@ -56,13 +49,11 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
56
49
  return width;
57
50
  }
58
51
  };
59
-
60
52
  const ZoomIn = () => {
61
53
  let zoom = 0;
62
54
  zoom = compare() / 25;
63
55
  return zoom;
64
56
  };
65
-
66
57
  const Pie = Donut ? css`
67
58
  position: relative;
68
59
  display: flex;
@@ -101,7 +92,6 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
101
92
  const offset = expandOnHover || props.expandedIndex > -1 ? expandSize + 2 : 0;
102
93
  const [isExpanded, setExpanded] = useState('false');
103
94
  const expandedIndex = useRef(null);
104
-
105
95
  const handleSectorHover = (data, index, e) => {
106
96
  if (expandOnHover) {
107
97
  setExpanded({
@@ -109,12 +99,10 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
109
99
  });
110
100
  expandedIndex.current = index !== null ? index : props.expandedIndex > -1 ? props.expandedIndex : null;
111
101
  }
112
-
113
102
  if (onSectorHover) {
114
103
  onSectorHover(data, index, e);
115
104
  }
116
105
  };
117
-
118
106
  const renderSingleData = (d, center) => {
119
107
  return jsx(Circle, {
120
108
  center: center,
@@ -127,13 +115,14 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
127
115
  ...d
128
116
  });
129
117
  };
130
-
131
118
  const renderMultipleData = center => {
132
119
  return jsx(Sectors, {
133
120
  center: center,
134
- data: expandOnHover ? data.map((d, i) => ({ ...d,
121
+ data: expandOnHover ? data.map((d, i) => ({
122
+ ...d,
135
123
  expanded: `${isExpanded ? i === expandedIndex.current : i === props.expandedIndex}`
136
- })) : data.map((d, i) => ({ ...d,
124
+ })) : data.map((d, i) => ({
125
+ ...d,
137
126
  expanded: `${i === props.expandedIndex}`
138
127
  })),
139
128
  ...props,
@@ -143,13 +132,11 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
143
132
  onSectorHover: handleSectorHover
144
133
  });
145
134
  };
146
-
147
135
  useEffect(() => {
148
136
  if (direction === 'bottom' && viewData) {
149
137
  document.getElementById(`DGN-CUI-Container-PieChart`).style.display = "inherit";
150
138
  document.getElementById(`DGN-CUI-TableData-PieChart`).style.display = "flex";
151
139
  }
152
-
153
140
  if (direction === 'left' && viewData) {
154
141
  document.getElementById(`DGN-CUI-Container-PieChart`).style.position = "relative";
155
142
  document.getElementById(`DGN-CUI-TableData-PieChart`).style.position = "fixed";
@@ -244,19 +231,14 @@ PieChart.defaultProps = {
244
231
  PieChart.propTypes = {
245
232
  /** the viewData will display information about the input data */
246
233
  viewData: PropTypes.bool,
247
-
248
234
  /** drawn Ratio of Width entered by user, default is: 900px */
249
235
  width: PropTypes.number,
250
-
251
236
  /** drawn Ratio of Height entered by user, default is: 500px */
252
237
  height: PropTypes.number,
253
-
254
238
  /** change from PieChart to DonutChart */
255
239
  Donut: PropTypes.bool,
256
-
257
240
  /** Typography of font in core, default: h4 */
258
241
  type: PropTypes.string,
259
-
260
242
  /** The array of elements that appear in the PieChart */
261
243
  data: PropTypes.arrayOf(PropTypes.shape({
262
244
  color: PropTypes.string,
@@ -264,46 +246,32 @@ PieChart.propTypes = {
264
246
  quantity: PropTypes.number.isRequired,
265
247
  href: PropTypes.string
266
248
  })).isRequired,
267
-
268
249
  /** the animation expand On Hover */
269
250
  expandOnHover: PropTypes.bool,
270
-
271
251
  /** the direction custom position data */
272
252
  direction: PropTypes.string,
273
-
274
253
  /** the Size expand On Hover */
275
254
  expandSize: PropTypes.number,
276
-
277
255
  /** the specified position is hovering by default */
278
256
  expandedIndex: PropTypes.number,
279
-
280
257
  /** returns the data of the object to be hover */
281
258
  onSectorHover: PropTypes.func,
282
-
283
259
  /** the StrokeWidth change color border and Stroke */
284
260
  strokeColor: Sector.propTypes.strokeColor,
285
-
286
261
  /** it can be applied to any element but it has effect only on the following nine */
287
262
  strokeLinejoin: Sector.propTypes.strokeLinejoin,
288
-
289
263
  /** The strokeWidth attribute is a presentation attribute defining the width of the stroke to be applied to the shape */
290
264
  strokeWidth: Sector.propTypes.strokeWidth,
291
-
292
265
  /** The starting angle is drawn in a circle from data first */
293
266
  startAngle: PropTypes.number,
294
-
295
267
  /** */
296
268
  angleMargin: PropTypes.number,
297
-
298
269
  /** The viewBox attribute defines the position and dimension, in user space, of an SVG viewport */
299
270
  viewBoxSize: PropTypes.number,
300
-
301
271
  /** The transition-duration CSS property sets the length of time a transition animation should take to complete. Default 0.3s */
302
272
  transitionDuration: Sector.propTypes.transitionDuration,
303
-
304
273
  /** The transition-timing-function CSS property sets how intermediate values are calculated for CSS properties being affected*/
305
274
  transitionTimingFunction: Sector.propTypes.transitionTimingFunction,
306
-
307
275
  /** The title is add from the data */
308
276
  name: Sector.propTypes.name
309
277
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import PropTypes from 'prop-types';
5
4
  import { memo, forwardRef } from 'react';