diginet-core-ui 1.3.24 → 1.3.29

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 (153) hide show
  1. package/assets/fonts/SF-Pro-Display-Bold.otf +0 -0
  2. package/assets/fonts/SF-Pro-Display-Medium.otf +0 -0
  3. package/assets/fonts/SF-Pro-Display-Regular.otf +0 -0
  4. package/assets/images/icons/wifi.svg +3 -0
  5. package/assets/images/menu/dhr/MHRM09N0004.svg +14 -0
  6. package/assets/images/menu/dhr/MHRP09N0028.svg +6 -0
  7. package/assets/images/menu/dhr/MHRP09N0029.svg +14 -0
  8. package/assets/images/menu/dhr/MHRP09N0030.svg +4 -0
  9. package/assets/images/menu/dhr/MHRP09N0031.svg +5 -0
  10. package/assets/images/menu/dhr/MHRP29N0012.svg +7 -0
  11. package/assets/images/menu/dhr/MHRP29N0021.svg +8 -0
  12. package/assets/images/menu/dhr/MHRP29N0022.svg +9 -0
  13. package/assets/images/menu/dhr/MHRP29N0023.svg +22 -0
  14. package/assets/images/menu/dhr/MHRP39N0015.svg +5 -0
  15. package/assets/images/menu/dhr/TASK.svg +9 -0
  16. package/assets/images/menu/erp/D05.svg +8 -0
  17. package/assets/images/menu/erp/D06.svg +4 -0
  18. package/assets/images/menu/erp/D90R.svg +9 -0
  19. package/assets/images/menu/erp/DBC.svg +9 -0
  20. package/assets/images/menu/erp/{W05F0006.svg → W05F0006N0000.svg} +0 -0
  21. package/assets/images/menu/erp/{W05F0008.svg → W05F0008N0000.svg} +0 -0
  22. package/assets/images/menu/erp/{W05F4000.svg → W05F4000N0000.svg} +0 -0
  23. package/assets/images/menu/erp/{W06F0005.svg → W06F0005N0000.svg} +0 -0
  24. package/assets/images/menu/erp/{W06F0006.svg → W06F0006N0000.svg} +0 -0
  25. package/assets/images/menu/erp/{W06F0008.svg → W06F0008N0000.svg} +0 -0
  26. package/assets/images/menu/erp/W94F1000N0000.svg +9 -0
  27. package/assets/images/menu/erp/W94F1000N0001.svg +9 -0
  28. package/components/accordion/css.js +42 -33
  29. package/components/accordion/details.js +29 -17
  30. package/components/accordion/group.js +23 -23
  31. package/components/accordion/index.js +36 -27
  32. package/components/accordion/summary.js +10 -11
  33. package/components/alert/index.js +97 -91
  34. package/components/alert/notify.js +10 -8
  35. package/components/avatar/index.js +19 -17
  36. package/components/badge/index.js +122 -139
  37. package/components/button/icon.js +242 -334
  38. package/components/button/index.js +272 -427
  39. package/components/button/more.js +4 -5
  40. package/components/button/ripple-effect.js +4 -6
  41. package/components/card/body-card.js +4 -6
  42. package/components/card/card.js +4 -8
  43. package/components/card/index.js +4 -5
  44. package/components/chart/Pie/Sector.js +4 -5
  45. package/components/chart/Pie/Sectors.js +5 -5
  46. package/components/chart/Pie/index.js +8 -9
  47. package/components/chart/Pie-v2/Sector.js +4 -5
  48. package/components/chart/Pie-v2/Sectors.js +7 -8
  49. package/components/chart/Pie-v2/index.js +11 -16
  50. package/components/chart/bar/Bar.js +2 -3
  51. package/components/chart/bar/Labels.js +9 -11
  52. package/components/chart/bar/index.js +17 -9
  53. package/components/chart/bar-v2/Bar.js +2 -3
  54. package/components/chart/bar-v2/Labels.js +9 -11
  55. package/components/chart/bar-v2/index.js +17 -9
  56. package/components/chart/line/Labels.js +8 -10
  57. package/components/chart/line/Point.js +2 -3
  58. package/components/chart/line/index.js +17 -9
  59. package/components/chart/line-v2/Labels.js +8 -10
  60. package/components/chart/line-v2/Point.js +2 -3
  61. package/components/chart/line-v2/index.js +17 -9
  62. package/components/chip/attach.js +12 -16
  63. package/components/chip/index.js +8 -11
  64. package/components/collapse/index.js +4 -5
  65. package/components/divider/index.js +27 -14
  66. package/components/form-control/attachment/index.js +143 -87
  67. package/components/form-control/calendar/function.js +24 -23
  68. package/components/form-control/calendar/index.js +2 -4
  69. package/components/form-control/calendar/range.js +3 -4
  70. package/components/form-control/checkbox/index.js +85 -71
  71. package/components/form-control/control/index.js +4 -6
  72. package/components/form-control/date-picker/index-old.js +0 -2
  73. package/components/form-control/date-picker/index.js +39 -43
  74. package/components/form-control/date-range-picker/index.js +26 -28
  75. package/components/form-control/dropdown/index.js +173 -202
  76. package/components/form-control/dropdown-box/index.js +72 -49
  77. package/components/form-control/form-group/index.js +4 -5
  78. package/components/form-control/helper-text/index.js +4 -5
  79. package/components/form-control/input-base/index.js +28 -38
  80. package/components/form-control/label/index.js +23 -13
  81. package/components/form-control/money-input/index.js +6 -6
  82. package/components/form-control/number-input/index.js +12 -14
  83. package/components/form-control/phone-input/index.js +4 -5
  84. package/components/form-control/radio/index.js +7 -15
  85. package/components/form-control/text-input/index.js +14 -24
  86. package/components/form-control/time-picker/index.js +15 -26
  87. package/components/form-control/time-picker/swiper.js +2 -4
  88. package/components/form-control/toggle/index.js +22 -18
  89. package/components/form-view/helper-text.js +4 -5
  90. package/components/form-view/index.js +4 -5
  91. package/components/form-view/input.js +5 -7
  92. package/components/form-view/label.js +2 -6
  93. package/components/list/list-item-action.js +7 -8
  94. package/components/list/list-item-icon.js +4 -5
  95. package/components/list/list-item-text.js +4 -5
  96. package/components/list/list-item.js +4 -5
  97. package/components/list/list.js +4 -5
  98. package/components/list/sub-header.js +4 -5
  99. package/components/modal/body.js +4 -6
  100. package/components/modal/footer.js +4 -6
  101. package/components/modal/header.js +8 -14
  102. package/components/modal/index.js +4 -5
  103. package/components/modal/modal.js +6 -13
  104. package/components/others/extra/index.js +4 -8
  105. package/components/others/option-wrapper/index.js +57 -0
  106. package/components/others/scrollbar/index.js +4 -5
  107. package/components/paging/page-info.js +282 -231
  108. package/components/paging/page-selector.js +4 -7
  109. package/components/popover/index.js +6 -7
  110. package/components/popup/danger_popup.js +8 -18
  111. package/components/popup/index.js +26 -34
  112. package/components/popup/proposals_popup.js +9 -16
  113. package/components/popup/v2/danger-popup.js +4 -6
  114. package/components/popup/v2/index.js +116 -98
  115. package/components/popup/v2/info-popup.js +4 -6
  116. package/components/popup/v2/success-popup.js +4 -6
  117. package/components/popup/v2/warning-popup.js +4 -6
  118. package/components/popup/v2/yes-no-popup.js +4 -6
  119. package/components/progress/circular.js +17 -26
  120. package/components/progress/linear.js +11 -13
  121. package/components/rating/index.js +114 -233
  122. package/components/slider/slider-container.js +15 -10
  123. package/components/slider/slider-item.js +10 -12
  124. package/components/status/index.js +63 -57
  125. package/components/tab/tab-container.js +26 -24
  126. package/components/tab/tab-header.js +36 -27
  127. package/components/tab/tab-panel.js +32 -15
  128. package/components/tab/tab.js +79 -80
  129. package/components/tooltip/index.js +4 -4
  130. package/components/transfer/index.js +10 -11
  131. package/components/tree-view/css.js +2 -0
  132. package/components/tree-view/index.js +14 -13
  133. package/components/typography/index.js +6 -112
  134. package/css/styles.css +1 -1
  135. package/css/styles.css.map +1 -1
  136. package/global/index.js +2 -0
  137. package/icons/basic.js +1648 -959
  138. package/icons/effect.js +45 -103
  139. package/package.json +1 -1
  140. package/readme.md +66 -0
  141. package/styles/color-helper.js +7 -146
  142. package/styles/colors.js +6 -2
  143. package/styles/font.js +9 -0
  144. package/styles/general.js +100 -7
  145. package/styles/typography.js +25 -26
  146. package/theme/settings.js +9 -2
  147. package/theme/theme-provider.js +15 -7
  148. package/theme/with-styles.js +2 -4
  149. package/theme/with-theme.js +2 -4
  150. package/utils/isMobile.js +21 -0
  151. package/utils/renderHTML.js +4 -5
  152. package/utils/renderIcon.js +15 -11
  153. package/utils/updatePosition.js +2 -2
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
@@ -10,7 +8,7 @@ import Popup from './';
10
8
  import { Button } from '../';
11
9
  import { renderHTML } from '../../utils';
12
10
  import { Warning } from '../../icons';
13
- import theme from '../../theme/settings';
11
+ import { typography } from '../../styles/typography';
14
12
 
15
13
  const DangerPopup = ({
16
14
  open,
@@ -52,20 +50,12 @@ const DangerPopup = ({
52
50
  margin-right: 13px;
53
51
  }
54
52
  .popup-title {
55
- font-family: ${theme.typography.fontFamily};
56
- font-style: normal;
57
- font-weight: bold;
58
- font-size: 20px;
59
- line-height: 22px;
53
+ ${typography.heading1};
60
54
  color: inherit;
61
55
  }
62
56
  `;
63
57
  const PopupWarning = css`
64
- font-family: ${theme.typography.fontFamily};
65
- font-style: normal;
66
- font-weight: 500;
67
- font-size: 16px;
68
- line-height: 22px;
58
+ ${typography.paragraph1};
69
59
  text-align: center;
70
60
  color: inherit;
71
61
  `;
@@ -75,8 +65,7 @@ const DangerPopup = ({
75
65
  justify-content: space-between;
76
66
  button {
77
67
  min-width: 176px;
78
- font-size: 14px;
79
- font-family: ${theme.typography.fontFamily};
68
+ ${typography.paragraph1};
80
69
  &.button-confirm {
81
70
  &.popup-timing {
82
71
  color: ${buttonTimingColor};
@@ -140,11 +129,12 @@ const DangerPopup = ({
140
129
  if (timer) clearInterval(timer);
141
130
  };
142
131
  }, [open]);
143
- return jsx(Popup, _extends({
132
+ return jsx(Popup, {
144
133
  popupStyle: popupStyles,
145
134
  type: 'custom',
146
- open: open
147
- }, props), jsx("div", {
135
+ open: open,
136
+ ...props
137
+ }, jsx("div", {
148
138
  css: PopupContent
149
139
  }, jsx("div", {
150
140
  css: PopupInfo
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
@@ -7,15 +5,16 @@ import React, { memo, useEffect, useMemo, useRef, forwardRef, useState } from 'r
7
5
  import ReactDOM, { createPortal } from 'react-dom';
8
6
  import PropTypes from 'prop-types';
9
7
  import { jsx, css, keyframes } from '@emotion/core';
10
- import { Button, Typography } from '../';
11
- import Icon, { Info, Archive, Warning, Failed } from '../../icons';
8
+ import { Button, ButtonIcon, Typography } from '../';
9
+ import { Info, ApprovalFilled, Warning, Failed } from '../../icons';
12
10
  import theme from '../../theme/settings';
13
11
  import { getGlobal } from '../../global';
12
+ import { typography } from '../../styles/typography';
14
13
  export const icons = {
15
14
  info: jsx(Info, {
16
15
  viewBox: true
17
16
  }),
18
- success: jsx(Archive, {
17
+ success: jsx(ApprovalFilled, {
19
18
  viewBox: true
20
19
  }),
21
20
  warning: jsx(Warning, {
@@ -140,8 +139,7 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
140
139
  color: inherit;
141
140
  text-align: center;
142
141
  align-items: center;
143
- font-family: ${theme.typography.fontFamily};
144
- font-size: 16px;
142
+ ${typography.paragraph1};
145
143
  }
146
144
  `;
147
145
  const PopupYesNo = css`
@@ -204,23 +202,23 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
204
202
  className: 'popup-title'
205
203
  }, jsx(Typography, null, message))), /(yes.*?no)|(confirm)/i.test(type) && jsx("div", {
206
204
  css: PopupYesNo
207
- }, jsx(Button, _extends({
205
+ }, jsx(Button, {
208
206
  viewType: 'filled',
209
207
  color: 'info',
210
208
  style: {
211
209
  minWidth: 104
212
- }
213
- }, confirmProps, {
210
+ },
211
+ ...confirmProps,
214
212
  onClick: confirmHandler
215
- }), /confirm/i.test(type) ? confirmText : yesText), jsx(Button, _extends({
213
+ }, /confirm/i.test(type) ? confirmText : yesText), jsx(Button, {
216
214
  viewType: 'outlined',
217
215
  style: {
218
216
  minWidth: 104,
219
217
  marginLeft: 24
220
- }
221
- }, cancelProps, {
218
+ },
219
+ ...cancelProps,
222
220
  onClick: cancelHandler
223
- }), /confirm/i.test(type) ? cancelText : noText)));
221
+ }, /confirm/i.test(type) ? cancelText : noText)));
224
222
  setCustom(newContent);
225
223
  setOpenState(true);
226
224
  };
@@ -323,12 +321,12 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
323
321
  className: 'DGN-UI-Portal',
324
322
  ref: ref,
325
323
  style: style
326
- }, jsx("div", _extends({
327
- css: PopupFrame
328
- }, props, {
324
+ }, jsx("div", {
325
+ css: PopupFrame,
326
+ ...props,
329
327
  style: popupStyle,
330
328
  className: 'DGN-UI-Popup ' + className
331
- }), custom ? custom : /^custom$/i.test(type) ? children : jsx("div", {
329
+ }, custom ? custom : /^custom$/i.test(type) ? children : jsx("div", {
332
330
  css: PopupContent,
333
331
  className: 'DGN-UI-Popup-Content'
334
332
  }, jsx("div", {
@@ -339,35 +337,29 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
339
337
  className: 'popup-title'
340
338
  }, jsx(Typography, null, title))), /(yes.*?no)|(confirm)/i.test(type) && jsx("div", {
341
339
  css: PopupYesNo
342
- }, jsx(Button, _extends({
340
+ }, jsx(Button, {
343
341
  viewType: 'filled',
344
342
  color: 'info',
345
343
  style: {
346
344
  minWidth: 104
347
- }
348
- }, confirmProps, {
345
+ },
346
+ ...confirmProps,
349
347
  onClick: onConfirmHandler
350
- }), /confirm/i.test(type) ? confirmText : yesText), jsx(Button, _extends({
348
+ }, /confirm/i.test(type) ? confirmText : yesText), jsx(Button, {
351
349
  viewType: 'outlined',
352
350
  style: {
353
351
  minWidth: 104,
354
352
  marginLeft: 24
355
- }
356
- }, cancelProps, {
353
+ },
354
+ ...cancelProps,
357
355
  onClick: onCancelHandler
358
- }), /confirm/i.test(type) ? cancelText : noText))), (clearAble || /info/i.test(type)) && jsx("div", {
356
+ }, /confirm/i.test(type) ? cancelText : noText))), (clearAble || /info/i.test(type)) && jsx("div", {
359
357
  css: PopupClearIcon,
360
358
  style: clearIconStyle
361
- }, jsx(Icon, {
359
+ }, jsx(ButtonIcon, {
360
+ viewType: 'ghost',
362
361
  name: 'close',
363
- width: "12",
364
- height: "12",
365
- color: "currentColor",
366
- onClick: e => onClosePopup(custom === false ? false : e),
367
- style: {
368
- width: '100%',
369
- height: '100%'
370
- }
362
+ onClick: e => onClosePopup(custom === false ? false : e)
371
363
  })))), document.body), [openState, custom, title, icon, type, onClose, onConfirm, onCancel]);
372
364
  return Popup;
373
365
  }));
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
@@ -7,8 +5,8 @@ import { memo, useEffect, useMemo, useRef, forwardRef } from 'react';
7
5
  import PropTypes from 'prop-types';
8
6
  import { jsx, css } from '@emotion/core';
9
7
  import theme from '../../theme/settings';
10
- import { Button } from '../';
11
- import Icon, { Close, Approval } from '../../icons';
8
+ import { Button, ButtonIcon } from '../';
9
+ import { Close, Approval } from '../../icons';
12
10
  import TextInput from '../form-control/text-input';
13
11
  const ProposalsPopup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
14
12
  open,
@@ -273,25 +271,20 @@ const ProposalsPopup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
273
271
  }, [type, buttonText, disabled]);
274
272
  const popupClearIcon = useMemo(() => clearAble && jsx("div", {
275
273
  css: PopupClearIcon
276
- }, jsx(Icon, {
274
+ }, jsx(ButtonIcon, {
275
+ viewType: 'ghost',
277
276
  name: 'Close',
278
- width: "12",
279
- height: "12",
280
- onClick: onClosePopup,
281
- style: {
282
- width: '100%',
283
- height: '100%'
284
- }
277
+ onClick: onClosePopup
285
278
  })), [clearAble]);
286
279
  return jsx("div", {
287
280
  css: PopupContainer,
288
281
  ref: ref,
289
282
  style: style
290
- }, jsx("div", _extends({
291
- css: PopupFrame
292
- }, props, {
283
+ }, jsx("div", {
284
+ css: PopupFrame,
285
+ ...props,
293
286
  style: popupStyle
294
- }), jsx("div", {
287
+ }, jsx("div", {
295
288
  css: PopupContent
296
289
  }, popupInput, popupAction), popupClearIcon));
297
290
  }));
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
@@ -8,10 +6,10 @@ import { memo, forwardRef } from 'react';
8
6
  import PopupV2 from '.';
9
7
  const DangerPopup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({ ...props
10
8
  }, ref) => {
11
- return jsx(PopupV2, _extends({
12
- ref: ref
13
- }, props, {
9
+ return jsx(PopupV2, {
10
+ ref: ref,
11
+ ...props,
14
12
  type: 'danger'
15
- }));
13
+ });
16
14
  }));
17
15
  export default DangerPopup;
@@ -1,49 +1,68 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
6
- import { memo, useEffect, useRef, useState, forwardRef, useImperativeHandle, Fragment } from 'react';
4
+ import { memo, useEffect, useRef, useState, forwardRef, useImperativeHandle, Fragment, useCallback } from 'react';
7
5
  import { createPortal } from 'react-dom';
8
6
  import { bool, oneOf, oneOfType, string, func, object, number, node, shape, instanceOf, elementType } from 'prop-types';
9
7
  import { jsx, css } from '@emotion/core';
10
- import { Button, Typography } from '../../';
11
- import { Close, Info, Archive, Warning, Failed } from '../../../icons';
8
+ import { Button, ButtonIcon, Typography } from '../../';
9
+ import { Info, ApprovalFilled, Warning, Failed } from '../../../icons';
12
10
  import { getGlobal } from '../../../global';
13
- import { lighten } from '../../../styles/color-helper';
14
- import { useTheme } from '../../../theme';
11
+ import { hexToRGBA } from '../../../styles/color-helper';
15
12
  import { capitalize, renderIcon } from '../../../utils';
16
13
  import { animations } from '../../../styles/animation';
14
+ import { color as colors } from '../../../styles/colors';
15
+ import { alignCenter, border, borderBox, borderRadius4px, cursorPointer, displayBlock, ellipsis, flexCol, flexRow, justifyCenter, justifyEnd, overflowHidden, positionFixed, positionRelative } from '../../../styles/general';
17
16
  const {
18
- colors
19
- } = useTheme();
17
+ system: {
18
+ white
19
+ },
20
+ semantic: {
21
+ success,
22
+ warning,
23
+ danger,
24
+ info
25
+ },
26
+ fill: {
27
+ 'scrollbar-tabbar': scrollbar,
28
+ hover
29
+ }
30
+ } = colors;
20
31
  export const icons = {
21
32
  yesno: jsx(Info, {
22
33
  viewBox: true,
23
34
  width: 40,
24
- height: 40
35
+ height: 40,
36
+ color: info
25
37
  }),
26
38
  info: jsx(Info, {
27
39
  viewBox: true,
28
40
  width: 40,
29
- height: 40
41
+ height: 40,
42
+ color: info
30
43
  }),
31
- success: jsx(Archive, {
44
+ success: jsx(ApprovalFilled, {
32
45
  viewBox: true,
33
46
  width: 40,
34
- height: 40
47
+ height: 40,
48
+ color: success
35
49
  }),
36
50
  warning: jsx(Warning, {
37
51
  viewBox: true,
38
52
  width: 40,
39
- height: 40
53
+ height: 40,
54
+ color: warning
40
55
  }),
41
56
  danger: jsx(Failed, {
42
57
  viewBox: true,
43
58
  width: 40,
44
- height: 40
59
+ height: 40,
60
+ color: danger
45
61
  })
46
62
  };
63
+ const colorMap = new Map([['yesno', info], ['success', success], ['warning', warning], ['danger', danger], ['info', info]]);
64
+ const fadeInDown = animations.fadeInDown;
65
+ const fadeOutUp = animations.fadeOutUp;
47
66
  const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
48
67
  open,
49
68
  type,
@@ -70,16 +89,15 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
70
89
  const [openState, setOpenState] = useState(open);
71
90
  const [custom, setCustom] = useState(null);
72
91
  const [showMoreDescription, setShowMoreDescription] = useState(false);
73
- const fadeInDown = animations.fadeInDown;
74
- const fadeOutUp = animations.fadeOutUp;
92
+ const [descriptionLines, setDescriptionLines] = useState(0);
75
93
  const PopupRoot = css`
76
- display: flex;
77
- position: fixed;
94
+ ${flexRow}
95
+ ${positionFixed}
96
+ ${justifyCenter}
78
97
  width: 100%;
79
98
  height: 100%;
80
99
  top: 0;
81
100
  left: 0;
82
- justify-content: center;
83
101
  inset: 0;
84
102
  background-color: rgba(21, 26, 48, 0.5);
85
103
  opacity: 0;
@@ -87,16 +105,15 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
87
105
  z-index: 9002;
88
106
  word-break: break-word;
89
107
  .DGN-UI-Popup {
90
- display: flex;
91
- flex-direction: column;
108
+ ${flexCol}
109
+ ${borderRadius4px}
110
+ ${borderBox}
92
111
  width: ${isNaN(width) ? width : width + 'px'};
93
112
  height: fit-content;
94
113
  max-width: 80%;
95
114
  max-height: 80%;
96
115
  margin: ${isNaN(top) ? top : top + 'px'} auto auto;
97
- background-color: ${colors.white};
98
- border-radius: 4px;
99
- box-sizing: border-box;
116
+ background-color: ${white};
100
117
  box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.25);
101
118
  animation: ${fadeOutUp} 0.2s ease;
102
119
  animation-fill-mode: forwards;
@@ -104,96 +121,80 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
104
121
  animation-name: ${fadeInDown};
105
122
  }
106
123
  .DGN-UI-Popup-Header {
107
- display: flex;
108
- flex-direction: row;
109
- align-items: center;
124
+ ${flexRow}
125
+ ${alignCenter}
110
126
  min-height: 40px;
111
- padding: 0 16px;
127
+ padding: 0 8px 0 16px;
112
128
  border-radius: 4px 4px 0px 0px;
113
129
  .DGN-UI-Popup-Header-Title {
114
- display: flex;
130
+ ${flexRow}
131
+ ${ellipsis}
115
132
  width: calc(100% - 24px);
116
- white-space: nowrap;
117
- overflow-x: hidden;
118
- text-overflow: ellipsis;
119
- font-weight: bold;
120
133
  }
121
- .DGN-UI-Popup-Header-Icon {
122
- display: block;
123
- width: 24px;
124
- height: 24px;
125
- cursor: pointer;
126
- transition: filter 0.1s linear;
127
- &:hover {
128
- filter: brightness(0.85);
129
- }
130
- }
131
- color: ${colors[type === 'yesno' ? 'info' : type]};
132
- background-color: ${lighten(colors[type === 'yesno' ? 'info' : type], 0.85)};
134
+ color: ${colorMap.get(type)};
135
+ background-color: ${hexToRGBA(colorMap.get(type), 0.15)};
133
136
  }
134
137
  .DGN-UI-Popup-Body {
135
- display: flex;
136
- position: relative;
137
- flex-direction: row;
138
+ ${flexRow}
139
+ ${positionRelative}
138
140
  flex: 1 1 auto;
139
141
  padding: 16px;
140
142
  overflow: auto;
141
143
  &::-webkit-scrollbar {
144
+ ${borderRadius4px}
142
145
  width: 24px;
143
146
  background-color: #fff !important;
144
- border-radius: 4px;
145
147
  }
146
148
  &::-webkit-scrollbar-thumb {
149
+ ${border(8, 'transparent')}
147
150
  border-radius: 24px;
148
- border: 8px solid transparent;
149
151
  mix-blend-mode: normal;
150
- background-color: ${colors.scrollbar} !important;
152
+ background-color: ${scrollbar} !important;
151
153
  background-clip: content-box;
152
154
  }
153
155
  &::-webkit-scrollbar-thumb:hover {
156
+ ${border(8, 'transparent')}
154
157
  border-radius: 24px;
155
- border: 8px solid transparent;
156
158
  mix-blend-mode: normal;
157
- background-color: ${colors.scrollbarHover} !important;
159
+ background-color: ${hover} !important;
158
160
  background-clip: content-box;
159
161
  }
160
162
  .DGN-UI-Popup-Body-Icon {
161
- display: block;
163
+ ${displayBlock}
162
164
  width: 40px;
163
165
  margin-right: 16px;
164
166
  border-radius: 50%;
165
167
  }
166
168
  .DGN-UI-Popup-Body-Description {
167
- display: flex;
168
- position: relative;
169
+ ${flexRow}
170
+ ${positionRelative}
171
+ ${alignCenter}
169
172
  min-height: 40px;
170
173
  height: max-content;
171
- align-items: center;
172
174
  .DGN-UI-Popup-Body-Subtitle {
173
175
  margin-bottom: ${(description === null || description === void 0 ? void 0 : description.length) > 0 ? '8px' : '0px'};
174
176
  }
175
177
  .DGN-UI-Popup-Body-Detail {
176
- overflow: hidden;
178
+ ${overflowHidden}
177
179
  text-overflow: ellipsis;
178
180
  display: -webkit-box;
179
- -webkit-line-clamp: ${showMoreDescription ? 'none' : subtitle ? 1 : 3};
181
+ -webkit-line-clamp: ${showMoreDescription ? 'none' : subtitle && descriptionLines > 1 ? 1 : descriptionLines > 3 ? 3 : 'none'};
180
182
  -webkit-box-orient: vertical;
181
183
  }
182
184
  .DGN-More-Action {
183
- display: block;
185
+ ${displayBlock}
186
+ ${cursorPointer}
184
187
  width: fit-content;
185
188
  margin-top: 16px;
186
189
  margin-bottom: ${type === 'yesno' ? '0px' : '8px'};
187
190
  text-decoration: underline;
188
- color: ${colors.info};
189
- cursor: pointer;
191
+ color: ${info};
190
192
  }
191
193
  }
192
194
  }
193
195
  .DGN-UI-Popup-Action {
194
- display: flex;
195
- flex-direction: row;
196
- justify-content: flex-end;
196
+ ${flexRow}
197
+ ${justifyEnd}
197
198
  padding: 8px 16px 16px 16px;
198
199
  .DGN-UI-Button {
199
200
  margin: 0;
@@ -247,14 +248,15 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
247
248
  className: 'DGN-UI-Popup-Header ' + 'DGN-' + capitalize(newProps.type)
248
249
  }, jsx(Typography, {
249
250
  className: 'DGN-UI-Popup-Header-Title',
251
+ type: 'h3',
250
252
  color: 'inherit'
251
- }, getTitle(newProps.title, newProps.type)), jsx("div", {
252
- className: 'DGN-UI-Popup-Header-Icon',
253
+ }, getTitle(newProps.title, newProps.type)), jsx(ButtonIcon, {
254
+ circular: true,
255
+ viewType: 'text',
256
+ color: type === 'yesno' ? 'info' : type,
257
+ name: 'Close',
253
258
  onClick: () => onClosePopup()
254
- }, jsx(Close, {
255
- viewBox: true,
256
- color: 'currentColor'
257
- }))), jsx("div", {
259
+ })), jsx("div", {
258
260
  className: 'DGN-UI-Popup-Body'
259
261
  }, newProps.icon !== false && jsx("div", {
260
262
  className: 'DGN-UI-Popup-Body-Icon'
@@ -269,17 +271,19 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
269
271
  type: 'p2'
270
272
  }, newProps.description))), (newProps.onConfirm || newProps.onCancel || newProps.type === 'yesno') && jsx("div", {
271
273
  className: 'DGN-UI-Popup-Action'
272
- }, (newProps.onConfirm || newProps.type === 'yesno') && jsx(Button, _extends({
274
+ }, (newProps.onConfirm || newProps.type === 'yesno') && jsx(Button, {
273
275
  viewType: 'filled',
274
276
  label: newProps.yesText || getGlobal('ok').toUpperCase(),
275
277
  color: newProps.type,
276
- onClick: newProps.onConfirm
277
- }, newProps.confirmProps)), (newProps.onCancel || newProps.type === 'yesno') && jsx(Button, _extends({
278
+ onClick: newProps.onConfirm,
279
+ ...newProps.confirmProps
280
+ }), (newProps.onCancel || newProps.type === 'yesno') && jsx(Button, {
278
281
  viewType: 'outlined',
279
282
  label: newProps.noText || getGlobal('cancel').toUpperCase(),
280
283
  color: newProps.type,
281
- onClick: newProps.onCancel
282
- }, newProps.cancelProps))));
284
+ onClick: newProps.onCancel,
285
+ ...newProps.cancelProps
286
+ })));
283
287
  setCustom(popup);
284
288
  } else {
285
289
  setCustom(false);
@@ -290,6 +294,7 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
290
294
 
291
295
  const onClosePopup = (action = false) => {
292
296
  if (onClose && action) {
297
+ setOpenState(false);
293
298
  onClose();
294
299
  } else {
295
300
  if (ref.current) {
@@ -302,9 +307,17 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
302
307
  }
303
308
  };
304
309
 
310
+ const onRefChange = useCallback(node => {
311
+ if (node) {
312
+ setDescriptionLines(Math.round((node === null || node === void 0 ? void 0 : node.offsetHeight) / 18)); //18 is line-height of Typography p2
313
+
314
+ setShowMoreDescription(false);
315
+ }
316
+ }, []);
305
317
  useEffect(() => {
306
318
  if (open) {
307
319
  setOpenState(open);
320
+ setShowMoreDescription(true);
308
321
  } else {
309
322
  onClosePopup();
310
323
  }
@@ -322,30 +335,32 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
322
335
  }
323
336
  }, [openState]);
324
337
  useImperativeHandle(reference, () => {
325
- const abc = ref.current || {};
326
- abc.show = onShowPopup;
327
- abc.close = onClosePopup;
328
- return abc;
338
+ const currentRef = ref.current || {};
339
+ currentRef.show = onShowPopup;
340
+ currentRef.close = onClosePopup;
341
+ return currentRef;
329
342
  });
330
343
  return openState && /*#__PURE__*/createPortal(jsx("div", {
331
344
  css: PopupRoot,
332
345
  ref: ref,
333
346
  style: style,
334
347
  className: ('DGN-UI-Portal DGN-UI-Popup-Portal ' + className).trimRight()
335
- }, jsx("div", _extends({
336
- className: 'DGN-UI-Popup'
337
- }, props), custom ? custom : jsx(Fragment, null, jsx("div", {
348
+ }, jsx("div", {
349
+ className: 'DGN-UI-Popup',
350
+ ...props
351
+ }, custom ? custom : jsx(Fragment, null, jsx("div", {
338
352
  className: 'DGN-UI-Popup-Header ' + 'DGN-' + capitalize(type)
339
353
  }, jsx(Typography, {
340
354
  className: 'DGN-UI-Popup-Header-Title',
355
+ type: 'h3',
341
356
  color: 'inherit'
342
- }, getTitle(title)), jsx("div", {
343
- className: 'DGN-UI-Popup-Header-Icon',
357
+ }, getTitle(title)), jsx(ButtonIcon, {
358
+ circular: true,
359
+ viewType: 'text',
360
+ color: type === 'yesno' ? 'info' : type,
361
+ name: 'Close',
344
362
  onClick: e => onClosePopup(custom === false ? false : e)
345
- }, jsx(Close, {
346
- viewBox: true,
347
- color: 'currentColor'
348
- }))), jsx("div", {
363
+ })), jsx("div", {
349
364
  className: 'DGN-UI-Popup-Body'
350
365
  }, icon !== false && jsx("div", {
351
366
  className: 'DGN-UI-Popup-Body-Icon'
@@ -362,30 +377,33 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
362
377
  className: 'DGN-UI-Popup-Body-Subtitle',
363
378
  fullWidth: true
364
379
  }, subtitle), jsx(Typography, {
380
+ ref: onRefChange,
365
381
  type: 'p2',
366
382
  className: 'DGN-UI-Popup-Body-Detail'
367
- }, description), description && typeof description === 'string' && (description === null || description === void 0 ? void 0 : description.length) > 62 && jsx("span", {
383
+ }, description), (subtitle && descriptionLines > 1 || descriptionLines > 3) && jsx("span", {
368
384
  className: 'DGN-More-Action',
369
385
  onClick: () => setShowMoreDescription(!showMoreDescription)
370
386
  }, getGlobal(showMoreDescription ? 'showLess' : 'showMore'))))), (onConfirm || onCancel || type === 'yesno') && jsx("div", {
371
387
  className: 'DGN-UI-Popup-Action'
372
- }, (onConfirm || type === 'yesno') && jsx(Button, _extends({
388
+ }, (onConfirm || type === 'yesno') && jsx(Button, {
373
389
  viewType: 'filled',
374
390
  label: yesText || getGlobal('ok').toUpperCase(),
375
391
  color: type === 'yesno' ? 'info' : type,
376
392
  onClick: () => {
393
+ onClosePopup(true);
377
394
  onConfirm && onConfirm();
378
- onClose();
379
- }
380
- }, confirmProps)), (onCancel || type === 'yesno') && jsx(Button, _extends({
395
+ },
396
+ ...confirmProps
397
+ }), (onCancel || type === 'yesno') && jsx(Button, {
381
398
  viewType: 'outlined',
382
399
  label: noText || getGlobal('cancel').toUpperCase(),
383
400
  color: type === 'yesno' ? 'info' : type,
384
401
  onClick: () => {
402
+ onClosePopup(true);
385
403
  onCancel && onCancel();
386
- onClose();
387
- }
388
- }, cancelProps)))))), document.body);
404
+ },
405
+ ...cancelProps
406
+ }))))), document.body);
389
407
  }));
390
408
  Popup.defaultProps = {
391
409
  open: false,