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,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, forwardRef, useEffect, useMemo } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -18,7 +17,6 @@ const ListItemAction = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
18
17
  if (!ref) {
19
18
  ref = useRef(null);
20
19
  }
21
-
22
20
  const ListItemActionRoot = css`
23
21
  display: flex;
24
22
  position: relative;
@@ -37,7 +35,6 @@ const ListItemAction = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
37
35
  }, []);
38
36
  const ListItemActionView = useMemo(() => {
39
37
  let node = children;
40
-
41
38
  if (!node) {
42
39
  node = jsx(ButtonIcon, {
43
40
  viewType: 'ghost',
@@ -45,7 +42,6 @@ const ListItemAction = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
45
42
  onClick: onClick
46
43
  });
47
44
  }
48
-
49
45
  return jsx("div", {
50
46
  className: 'DGN-UI-List-Item-Action ' + className,
51
47
  css: ListItemActionRoot,
@@ -62,19 +58,14 @@ ListItemAction.defaultProps = {
62
58
  ListItemAction.propTypes = {
63
59
  /** the name of icon to display in ListItemAction (used instead of children) */
64
60
  name: PropTypes.string,
65
-
66
61
  /** classes name for list item action */
67
62
  className: PropTypes.string,
68
-
69
63
  /** the function to get ref of ListItemAction */
70
64
  refs: PropTypes.func,
71
-
72
65
  /** the function for click event */
73
66
  onClick: PropTypes.func,
74
-
75
67
  /** style inline of ListItemAction */
76
68
  style: PropTypes.object,
77
-
78
69
  /** content to display in ListItem */
79
70
  children: PropTypes.node
80
71
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, forwardRef, useEffect, useMemo } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -17,7 +16,6 @@ const ListItemIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
17
16
  if (!ref) {
18
17
  ref = useRef(null);
19
18
  }
20
-
21
19
  const ListItemIconRoot = css`
22
20
  display: flex;
23
21
  position: relative;
@@ -34,15 +32,12 @@ const ListItemIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
34
32
  }, []);
35
33
  const ListItemIconView = useMemo(() => {
36
34
  let node = children;
37
-
38
35
  if (!node) {
39
36
  const Icon = Icons[name];
40
-
41
37
  if (Icon) {
42
38
  node = jsx(Icon, null);
43
39
  }
44
40
  }
45
-
46
41
  return jsx("div", {
47
42
  css: ListItemIconRoot,
48
43
  className: 'DGN-UI-List-Item-Icon ' + className,
@@ -59,16 +54,12 @@ ListItemIcon.defaultProps = {
59
54
  ListItemIcon.propTypes = {
60
55
  /** the name of icon to display in ListItemIcon (used instead of children) */
61
56
  name: PropTypes.string,
62
-
63
57
  /** class for ListItemIcon */
64
58
  className: PropTypes.string,
65
-
66
59
  /** the function to get ref of ListItemIcon */
67
60
  refs: PropTypes.func,
68
-
69
61
  /** style inline of ListItemIcon */
70
62
  style: PropTypes.object,
71
-
72
63
  /** the icon to display in ListItem */
73
64
  children: PropTypes.node
74
65
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, forwardRef, useEffect, useMemo } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -15,7 +14,6 @@ const ListItemText = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
15
14
  if (!ref) {
16
15
  ref = useRef(null);
17
16
  }
18
-
19
17
  const ListItemTextRoot = css`
20
18
  display: flex;
21
19
  flex: 1 1 auto;
@@ -43,13 +41,10 @@ ListItemText.defaultProps = {
43
41
  ListItemText.propTypes = {
44
42
  /** class for ListItemText */
45
43
  className: PropTypes.string,
46
-
47
44
  /** the function to get ref of ListItemText */
48
45
  refs: PropTypes.func,
49
-
50
46
  /** style inline of ListItemText */
51
47
  style: PropTypes.object,
52
-
53
48
  /** content to display in ListItem */
54
49
  children: PropTypes.node
55
50
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, forwardRef, useEffect, useMemo } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -19,7 +18,6 @@ const ListItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
19
18
  if (!ref) {
20
19
  ref = useRef(null);
21
20
  }
22
-
23
21
  const ListItemRoot = css`
24
22
  display: flex;
25
23
  position: relative;
@@ -49,19 +47,16 @@ const ListItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
49
47
  padding-left: 56px;
50
48
  }
51
49
  `;
52
-
53
50
  const handleClick = e => {
54
51
  const {
55
52
  currentTarget,
56
53
  target
57
54
  } = e;
58
55
  const actionNode = currentTarget.querySelector('.DGN-UI-List-Item-Action');
59
-
60
56
  if (!actionNode || !actionNode.contains(target)) {
61
57
  onClick(e);
62
58
  }
63
59
  };
64
-
65
60
  useEffect(() => {
66
61
  if (refs) refs(ref);
67
62
  }, []);
@@ -69,7 +64,6 @@ const ListItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
69
64
  if (inset) {
70
65
  ref.current.classList.add('inset');
71
66
  }
72
-
73
67
  return () => {
74
68
  if (inset && ref.current) {
75
69
  ref.current.classList.remove('inset');
@@ -94,19 +88,14 @@ ListItem.defaultProps = {
94
88
  ListItem.propTypes = {
95
89
  /** has the same effect as a button if true */
96
90
  button: PropTypes.bool,
97
-
98
91
  /** classes name for list item */
99
92
  className: PropTypes.string,
100
-
101
93
  /** the function to get ref of ListItem */
102
94
  refs: PropTypes.func,
103
-
104
95
  /** the function for click event */
105
96
  onClick: PropTypes.func,
106
-
107
97
  /** style inline of ListItem */
108
98
  style: PropTypes.object,
109
-
110
99
  /** includes ListItemIcon, ListItemText, ListItemAction */
111
100
  children: PropTypes.node
112
101
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, forwardRef, useEffect, useMemo } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -21,7 +20,6 @@ const List = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
21
20
  if (!ref) {
22
21
  ref = useRef(null);
23
22
  }
24
-
25
23
  const ListRoot = css`
26
24
  display: block;
27
25
  position: relative;
@@ -79,7 +77,6 @@ const List = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
79
77
  if (level && level > 1 && level < levels.length) {
80
78
  ref.current.classList.add(levels[level]);
81
79
  }
82
-
83
80
  return () => {
84
81
  if (ref.current && level && level > 1 && level < levels.length) {
85
82
  ref.current.classList.remove(levels[level]);
@@ -90,7 +87,6 @@ const List = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
90
87
  if (scrollAble || maxHeight) {
91
88
  ref.current.classList.add('scroll-able');
92
89
  }
93
-
94
90
  return () => {
95
91
  if (ref.current && (scrollAble || maxHeight)) {
96
92
  ref.current.classList.remove('scroll-able');
@@ -101,7 +97,6 @@ const List = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
101
97
  if (style) {
102
98
  Object.assign(ref.current.style, style);
103
99
  }
104
-
105
100
  return () => {
106
101
  if (style && ref.current) {
107
102
  ref.current.style = null;
@@ -125,29 +120,21 @@ List.defaultProps = {
125
120
  List.propTypes = {
126
121
  /** fixed height of List and positive scroll list items */
127
122
  scrollAble: PropTypes.bool,
128
-
129
123
  /** class for List */
130
124
  className: PropTypes.string,
131
-
132
125
  /** width of list */
133
126
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
134
-
135
127
  /** max width */
136
128
  maxWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
137
-
138
129
  /** fixed height of List and positive scroll list items */
139
130
  maxHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
140
-
141
131
  /** represents the level of nested List, The higher the level, the content will be pushed */
142
132
  level: PropTypes.number,
143
133
  // [1,2,3,4,5]
144
-
145
134
  /** the function to get ref */
146
135
  refs: PropTypes.func,
147
-
148
136
  /** style inline for List */
149
137
  style: PropTypes.object,
150
-
151
138
  /** include list subheader, list items */
152
139
  children: PropTypes.node
153
140
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, forwardRef, useEffect, useMemo } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -15,7 +14,6 @@ const ListSubHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
15
14
  if (!ref) {
16
15
  ref = useRef(null);
17
16
  }
18
-
19
17
  const ListSubHeaderRoot = css`
20
18
  display: block;
21
19
  position: sticky;
@@ -50,10 +48,8 @@ const ListSubHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
50
48
  ListSubHeader.propTypes = {
51
49
  /** the function to get ref of ListSubHeader */
52
50
  refs: PropTypes.func,
53
-
54
51
  /** style inline of ListSubHeader */
55
52
  style: PropTypes.object,
56
-
57
53
  /** element to display is a subtitle */
58
54
  children: PropTypes.node
59
55
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useMemo, useRef, forwardRef, useImperativeHandle } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -27,11 +26,10 @@ const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
27
26
  useImperativeHandle(reference, () => {
28
27
  const currentRef = ref.current || {};
29
28
  currentRef.element = ref.current;
30
- const _instance = { ...action
29
+ const _instance = {
30
+ ...action
31
31
  }; // methods
32
-
33
32
  _instance.__proto__ = {}; // hidden methods
34
-
35
33
  currentRef.instance = _instance;
36
34
  return currentRef;
37
35
  });
@@ -72,10 +70,8 @@ ModalBody.defaultProps = {
72
70
  ModalBody.propTypes = {
73
71
  /** The content of the component. */
74
72
  children: PropTypes.node,
75
-
76
73
  /** Class for component. */
77
74
  className: PropTypes.string,
78
-
79
75
  /** Style inline of component. */
80
76
  style: PropTypes.object
81
77
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useMemo, useRef, forwardRef, useImperativeHandle } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -16,17 +15,14 @@ const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
16
15
  style
17
16
  }, reference) => {
18
17
  const ref = useRef(null);
19
-
20
18
  const _ModalFooterCSS = ModalFooterCSS(boxShadow);
21
-
22
19
  useImperativeHandle(reference, () => {
23
20
  const currentRef = ref.current || {};
24
21
  currentRef.element = ref.current;
25
- const _instance = { ...action
22
+ const _instance = {
23
+ ...action
26
24
  }; // methods
27
-
28
25
  _instance.__proto__ = {}; // hidden methods
29
-
30
26
  currentRef.instance = _instance;
31
27
  return currentRef;
32
28
  });
@@ -38,7 +34,6 @@ const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
38
34
  ref: ref
39
35
  }, children), [boxShadow, children, className, id, style]);
40
36
  }));
41
-
42
37
  const ModalFooterCSS = boxShadow => css`
43
38
  ${flexRow};
44
39
  ${positionRelative};
@@ -52,7 +47,6 @@ const ModalFooterCSS = boxShadow => css`
52
47
  order: 3;
53
48
  ${responsivePaddingCSS};
54
49
  `;
55
-
56
50
  ModalFooter.defaultProps = {
57
51
  boxShadow: '0px -1px 1px rgba(0, 0, 0, 0.25)',
58
52
  className: '',
@@ -61,13 +55,10 @@ ModalFooter.defaultProps = {
61
55
  ModalFooter.propTypes = {
62
56
  /** The box-shadow of component. */
63
57
  boxShadow: PropTypes.string,
64
-
65
58
  /** The content of the component. */
66
59
  children: PropTypes.node,
67
-
68
60
  /** Class for component. */
69
61
  className: PropTypes.string,
70
-
71
62
  /** Style inline of component. */
72
63
  style: PropTypes.object
73
64
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useMemo, useContext, useRef, forwardRef, useImperativeHandle } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -37,17 +36,14 @@ const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
37
36
  }, reference) => {
38
37
  const modal = useContext(ModalContext);
39
38
  const ref = useRef(null);
40
-
41
39
  const _ModalHeaderCSS = ModalHeaderCSS(modal);
42
-
43
40
  useImperativeHandle(reference, () => {
44
41
  const currentRef = ref.current || {};
45
42
  currentRef.element = ref.current;
46
- const _instance = { ...action
43
+ const _instance = {
44
+ ...action
47
45
  }; // methods
48
-
49
46
  _instance.__proto__ = {}; // hidden methods
50
-
51
47
  currentRef.instance = _instance;
52
48
  return currentRef;
53
49
  });
@@ -75,7 +71,6 @@ const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
75
71
  onClick: modal.close
76
72
  })), [children, className, id, showClose, style, title]);
77
73
  }));
78
-
79
74
  const ModalHeaderCSS = modal => css`
80
75
  ${flexRow};
81
76
  ${positionRelative};
@@ -90,7 +85,6 @@ const ModalHeaderCSS = modal => css`
90
85
  order: 1;
91
86
  ${responsivePaddingCSS};
92
87
  `;
93
-
94
88
  ModalHeader.defaultProps = {
95
89
  className: '',
96
90
  showClose: true,
@@ -100,16 +94,12 @@ ModalHeader.defaultProps = {
100
94
  ModalHeader.propTypes = {
101
95
  /** The content of the component. */
102
96
  children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
103
-
104
97
  /** Class for component. */
105
98
  className: PropTypes.string,
106
-
107
99
  /** If `true`, button close is shown. */
108
100
  showClose: PropTypes.bool,
109
-
110
101
  /** Style inline of component. */
111
102
  style: PropTypes.object,
112
-
113
103
  /** The content of the component if not have prop `children`. */
114
104
  title: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
115
105
  };
@@ -20,11 +20,10 @@ const ModalSample = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
20
20
  useImperativeHandle(reference, () => {
21
21
  const currentRef = ref.current || {};
22
22
  currentRef.element = ref.current;
23
- const _instance = { ...action
23
+ const _instance = {
24
+ ...action
24
25
  }; // methods
25
-
26
26
  _instance.__proto__ = {}; // hidden methods
27
-
28
27
  currentRef.instance = _instance;
29
28
  return currentRef;
30
29
  });
@@ -46,25 +45,18 @@ ModalSample.defaultProps = {
46
45
  ModalSample.propTypes = {
47
46
  /** Style inline of the body component. */
48
47
  bodyStyle: PropTypes.object,
49
-
50
48
  /** The content of the body component. */
51
49
  children: PropTypes.node,
52
-
53
50
  /** The content of the footer component. */
54
51
  footer: PropTypes.node,
55
-
56
52
  /** Style inline of the footer component. */
57
53
  footerStyle: PropTypes.object,
58
-
59
54
  /** Style inline of the header component. */
60
55
  headerStyle: PropTypes.object,
61
-
62
56
  /** Style inline of component. */
63
57
  style: PropTypes.object,
64
-
65
58
  /** The content of the header component. */
66
59
  title: PropTypes.node,
67
-
68
60
  /** Any props else. */
69
61
  props: PropTypes.any
70
62
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useState, useRef, forwardRef, useEffect, useMemo, useImperativeHandle } from 'react';
5
4
  import { createPortal } from 'react-dom';
@@ -48,44 +47,34 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
48
47
  const modalBoxRef = useRef(null);
49
48
  const [openState, setOpenState] = useState(open);
50
49
  const showModal = useDelayUnmount(openState, 200);
51
-
52
50
  const _ModalContainerCSS = ModalContainerCSS(zIndex, alignment, darkTheme);
53
-
54
51
  const _ModalBoxCSS = ModalBoxCSS(width, moveable, dragAnyWhere);
55
-
56
52
  const onShowModal = () => {
57
53
  setOpenState(true);
58
54
  };
59
-
60
55
  const onCloseModal = () => {
61
56
  document.body.style.overflow = overflow.current; // reset overflow of <body /> before open modal
62
-
63
57
  onClose && onClose();
64
58
  setOpenState(false);
65
59
  };
66
-
67
60
  const pressESCHandler = event => {
68
61
  if (event.key === 'Escape') {
69
62
  const modals = document.querySelectorAll('.DGN-UI-Portal');
70
-
71
63
  if ((modals === null || modals === void 0 ? void 0 : modals.length) > 1 && Array.from(modals)[modals.length - 1] && !Array.from(modals)[modals.length - 1].contains(ref.current)) {
72
64
  return;
73
65
  }
74
-
75
66
  onCloseModal();
76
67
  }
77
68
  };
78
-
79
69
  const dragMouseDown = e => {
80
70
  let pos1 = 0,
81
- pos2 = 0,
82
- pos3 = 0,
83
- pos4 = 0;
71
+ pos2 = 0,
72
+ pos3 = 0,
73
+ pos4 = 0;
84
74
  pos3 = e.clientX;
85
75
  pos4 = e.clientY;
86
76
  const maxTop = window.innerHeight - modalBoxRef.current.offsetHeight;
87
77
  const maxLeft = window.innerWidth - modalBoxRef.current.offsetWidth;
88
-
89
78
  if (modalBoxRef.current.style.display !== 'block') {
90
79
  const top = modalBoxRef.current.offsetTop;
91
80
  const left = modalBoxRef.current.offsetLeft;
@@ -95,14 +84,12 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
95
84
  modalBoxRef.current.style.top = top + 'px';
96
85
  modalBoxRef.current.style.left = left + 'px';
97
86
  }
98
-
99
87
  document.onmouseup = () => {
100
88
  /* stop moving when mouse button is released:*/
101
89
  document.onmouseup = null;
102
90
  document.onmousemove = null;
103
- }; // call a function whenever the cursor moves:
104
-
105
-
91
+ };
92
+ // call a function whenever the cursor moves:
106
93
  document.onmousemove = el => {
107
94
  pos1 = pos3 - el.clientX;
108
95
  pos2 = pos4 - el.clientY;
@@ -110,27 +97,23 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
110
97
  pos4 = el.clientY;
111
98
  let newTop = modalBoxRef.current.offsetTop - pos2;
112
99
  let newLeft = modalBoxRef.current.offsetLeft - pos1;
113
-
114
100
  if (!moveOutScreen) {
115
101
  if (newTop > maxTop) {
116
102
  newTop = maxTop;
117
103
  } else if (newTop < 0) {
118
104
  newTop = 0;
119
105
  }
120
-
121
106
  if (newLeft > maxLeft) {
122
107
  newLeft = maxLeft;
123
108
  } else if (newLeft < 0) {
124
109
  newLeft = 0;
125
110
  }
126
- } // set the element's new position:
127
-
128
-
111
+ }
112
+ // set the element's new position:
129
113
  modalBoxRef.current.style.top = newTop + 'px';
130
114
  modalBoxRef.current.style.left = newLeft + 'px';
131
115
  };
132
116
  };
133
-
134
117
  useEffect(() => {
135
118
  return () => {
136
119
  document.body.style.overflow = overflow.current; // reset overflow of <body /> before open modal
@@ -143,11 +126,9 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
143
126
  if (openState) {
144
127
  if (ref.current) {
145
128
  const modals = document.querySelectorAll('.DGN-UI-Modal');
146
-
147
129
  if (!darkTheme && modals && modals.length > 1) {
148
130
  ref.current.style.backgroundColor = 'transparent';
149
131
  }
150
-
151
132
  if (autoFocus) {
152
133
  if (!ref.current.contains(document.activeElement)) {
153
134
  ref.current.tabIndex = -1;
@@ -155,18 +136,14 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
155
136
  }
156
137
  }
157
138
  }
158
-
159
139
  overflow.current = document.body.style.overflow; // overflow of <body /> before open modal
160
-
161
- document.body.style.overflow = 'hidden'; // Allow press ESC to close popup
162
-
140
+ document.body.style.overflow = 'hidden';
141
+ // Allow press ESC to close popup
163
142
  if (pressESCToClose) {
164
143
  document.addEventListener('keydown', pressESCHandler);
165
144
  }
166
-
167
145
  return () => {
168
146
  document.body.style.overflow = overflow.current; // reset overflow of <body /> before open modal
169
-
170
147
  if (pressESCToClose) {
171
148
  document.removeEventListener('keydown', pressESCHandler);
172
149
  }
@@ -176,11 +153,10 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
176
153
  useImperativeHandle(reference, () => {
177
154
  const currentRef = ref.current || {};
178
155
  currentRef.element = ref.current;
179
- const _instance = { ...action
156
+ const _instance = {
157
+ ...action
180
158
  }; // methods
181
-
182
159
  _instance.__proto__ = {}; // hidden methods
183
-
184
160
  currentRef.instance = _instance;
185
161
  return currentRef;
186
162
  });
@@ -213,11 +189,9 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
213
189
  }, children))));
214
190
  return /*#__PURE__*/createPortal(node, document.body);
215
191
  }
216
-
217
192
  return null;
218
193
  }, [children, className, dragAnyWhere, id, moveable, moveOutScreen, onClose, style, openState, showModal]);
219
194
  }));
220
-
221
195
  const ModalContainerCSS = (zIndex, alignment, darkTheme) => css`
222
196
  ${flexRow};
223
197
  ${positionFixed};
@@ -230,7 +204,6 @@ const ModalContainerCSS = (zIndex, alignment, darkTheme) => css`
230
204
  top: 0;
231
205
  left: 0;
232
206
  `;
233
-
234
207
  const ModalBoxCSS = (width, moveable, dragAnyWhere) => css`
235
208
  ${paragraph1};
236
209
  ${flexCol};
@@ -258,7 +231,6 @@ const ModalBoxCSS = (width, moveable, dragAnyWhere) => css`
258
231
  animation-fill-mode: forwards;
259
232
  }
260
233
  `;
261
-
262
234
  Modal.defaultProps = {
263
235
  alignment: 'top',
264
236
  autoFocus: true,
@@ -276,43 +248,30 @@ Modal.defaultProps = {
276
248
  Modal.propTypes = {
277
249
  /** The component alignment. */
278
250
  alignment: PropTypes.oneOf(['top', 'center']),
279
-
280
251
  /** If `true`, focus when component is shown. */
281
252
  autoFocus: PropTypes.bool,
282
-
283
253
  /** The content of the component. */
284
254
  children: PropTypes.node,
285
-
286
255
  /** Class for component. */
287
256
  className: PropTypes.string,
288
-
289
257
  /** If `true`, dark backdrop when component is shown. */
290
258
  darkTheme: PropTypes.bool,
291
-
292
259
  /** If `true`, allow drag the component at any position. */
293
260
  dragAnyWhere: PropTypes.bool,
294
-
295
261
  /** If `true`, allow move the component by drag and move. */
296
262
  moveable: PropTypes.bool,
297
-
298
263
  /** If `true`, allows drag the component out of the screen. */
299
264
  moveOutScreen: PropTypes.bool,
300
-
301
265
  /** Callback fired when the component requests to be closed. */
302
266
  onClose: PropTypes.func,
303
-
304
267
  /** If `true`, the component is shown. */
305
268
  open: PropTypes.bool,
306
-
307
269
  /** If `true`, hitting escape will close component. */
308
270
  pressESCToClose: PropTypes.bool,
309
-
310
271
  /** Style inline of component. */
311
272
  style: PropTypes.object,
312
-
313
273
  /** Width of the component. */
314
274
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
315
-
316
275
  /** The z-index of component. */
317
276
  zIndex: PropTypes.number
318
277
  };