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 */
@@ -8,10 +6,17 @@ import PropTypes from 'prop-types';
8
6
  import { jsx, css } from '@emotion/core';
9
7
  import AccordionContext from './context';
10
8
  import Divider from '../divider';
11
- import theme from '../../theme/settings';
9
+ import { borderRadius4px, displayBlock, positionRelative } from '../../styles/general';
10
+ import { color as colors } from '../../styles/colors';
11
+ const {
12
+ line: {
13
+ category
14
+ }
15
+ } = colors;
12
16
  const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
13
17
  disabled,
14
18
  expand,
19
+ expanded,
15
20
  onClick,
16
21
  onExpand,
17
22
  onCollapse,
@@ -24,7 +29,21 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
24
29
  ref = useRef(null);
25
30
  }
26
31
 
27
- const [expandState, setExpandState] = useState(expand);
32
+ const [expandState, setExpandState] = useState(expanded || expand);
33
+ const AccordionRoot = css`
34
+ ${displayBlock}
35
+ ${positionRelative}
36
+ ${borderRadius4px}
37
+ width: 100%;
38
+ transition: margin 300ms ease;
39
+ &.boxShadow {
40
+ box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.25);
41
+ }
42
+ &.disabled {
43
+ cursor: no-drop;
44
+ box-shadow: none;
45
+ }
46
+ `;
28
47
  useEffect(() => {
29
48
  if (ref.current) {
30
49
  const previous = ref.current.previousElementSibling;
@@ -35,8 +54,8 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
35
54
  }
36
55
  }, [expandState]);
37
56
  useEffect(() => {
38
- setExpandState(expand);
39
- }, [expand]);
57
+ expanded !== undefined ? setExpandState(expanded) : setExpandState(expand);
58
+ }, [expand, expanded]);
40
59
 
41
60
  const onClickAccordion = () => {
42
61
  !!onClick && onClick({
@@ -44,27 +63,14 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
44
63
  });
45
64
  };
46
65
 
47
- const AccordionRoot = css`
48
- display: block;
49
- position: relative;
50
- width: 100%;
51
- border-radius: 4px;
52
- transition: margin 300ms ease;
53
- &.boxShadow {
54
- box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.25);
55
- }
56
- &.disabled {
57
- cursor: no-drop;
58
- box-shadow: none;
59
- }
60
- `;
61
- return jsx("div", _extends({
66
+ return jsx("div", {
62
67
  css: AccordionRoot,
63
- ref: ref
64
- }, props, {
65
- className: ['DGN-UI-Accordion', disabled ? 'disabled' : '', className, boxShadow === true ? 'boxShadow' : '', expandState ? 'expanding' : ''].join(' ').trim()
66
- }), jsx(AccordionContext.Provider, {
68
+ ref: ref,
69
+ ...props,
70
+ className: ['DGN-UI-Accordion', disabled ? 'disabled' : '', className, boxShadow === true ? 'boxShadow' : '', expandState ? 'expanding' : ''].join(' ').trim().replace(/\s+/g, ' ')
71
+ }, jsx(AccordionContext.Provider, {
67
72
  value: {
73
+ expanded,
68
74
  expandState,
69
75
  disabled,
70
76
  onClickAccordion: onClick ? onClickAccordion : null,
@@ -73,7 +79,7 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
73
79
  setExpandState
74
80
  }
75
81
  }, children, jsx(Divider, {
76
- color: theme.colors.borderTab,
82
+ color: category,
77
83
  style: {
78
84
  margin: 0,
79
85
  display: 'none'
@@ -90,9 +96,12 @@ Accordion.propTypes = {
90
96
  /** prevent all event if true */
91
97
  disabled: PropTypes.bool,
92
98
 
93
- /** expand immediate after render if true */
99
+ /** expand immediate after render if true (don't use this) */
94
100
  expand: PropTypes.bool,
95
101
 
102
+ /** expand state of accordion (use this) */
103
+ expanded: PropTypes.bool,
104
+
96
105
  /** class on element */
97
106
  className: PropTypes.string,
98
107
 
@@ -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 */
@@ -27,6 +25,7 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
27
25
  const expandIconRef = useRef(null);
28
26
  const timer = useRef(null);
29
27
  const {
28
+ expanded,
30
29
  expandState,
31
30
  disabled,
32
31
  onClickAccordion,
@@ -50,10 +49,10 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
50
49
  }
51
50
 
52
51
  if (expandState) {
53
- setExpandState(false);
52
+ if (expanded === undefined) setExpandState(false);
54
53
  !!onCollapse && onCollapse(e);
55
54
  } else if (!expandState) {
56
- setExpandState(true);
55
+ if (expanded === undefined) setExpandState(true);
57
56
  !!onExpand && onExpand(e);
58
57
  }
59
58
  }
@@ -117,21 +116,21 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
117
116
  showHideDetailHandler('hide');
118
117
  }
119
118
  }, [expandState]);
120
- return jsx("div", _extends({
119
+ return jsx("div", {
121
120
  css: SummaryRoot,
122
121
  ref: ref,
123
- tabIndex: "-1"
124
- }, props, {
122
+ tabIndex: "-1",
123
+ ...props,
125
124
  onClick: onClickHandler,
126
- className: ['DGN-UI-Accordion-Summary', disabled ? 'disabled' : '', expandIcon ? expandIconAt : '', className, background === true ? 'background' : '', expandState ? 'expanding' : ''].join(' ').trim()
127
- }), jsx("div", {
125
+ className: ['DGN-UI-Accordion-Summary', disabled ? 'disabled' : '', expandIcon ? expandIconAt : '', className, background === true ? 'background' : '', expandState ? 'expanding' : ''].join(' ').trim().replace(/\s+/g, ' ')
126
+ }, jsx("div", {
128
127
  className: 'DGN-UI-Accordion-Summary-Content'
129
128
  }, children), !!expandIcon && jsx("div", {
130
129
  className: 'Accordion-Icon-Root'
131
- }, jsx("div", _extends({}, expandIconProps, {
130
+ }, jsx("div", { ...expandIconProps,
132
131
  ref: expandIconRef,
133
132
  className: ['Accordion-Icon', collapseIcon ? '' : 'rotate-able', expandIconProps.className ? expandIconProps.className : ''].join(' ').trim()
134
- }), typeof expandIcon === 'string' ? renderIcon(expandIcon, 'effect', {
133
+ }, typeof expandIcon === 'string' ? renderIcon(expandIcon, 'effect', {
135
134
  className: 'Accordion-Expand-Icon'
136
135
  }) : jsx("span", {
137
136
  className: 'Accordion-Expand-Icon effect'
@@ -1,49 +1,41 @@
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
4
  import { memo, useState, useEffect, useMemo, useRef, forwardRef } from 'react';
7
5
  import PropTypes from 'prop-types';
8
6
  import { jsx, css } from '@emotion/core';
9
- import { info1, info9, success1, success9, warning1, warning9, danger1, danger9 } from '../../styles/colors';
10
- import theme from '../../theme/settings';
11
- import { Close, Archive, Info, Warning, Block } from '../../icons';
12
7
  import LinearProgress from '../progress/linear';
13
- const icons = {
14
- primary: jsx(Info, null),
15
- success: jsx(Archive, null),
16
- warning: jsx(Warning, null),
17
- danger: jsx(Block, {
18
- color: 'currentColor'
19
- })
20
- };
21
- const colors = {
22
- color: {
23
- primary: theme.colors.info,
24
- success: theme.colors.success,
25
- warning: theme.colors.warning,
26
- danger: theme.colors.danger
27
- },
28
- backgroundColor: {
29
- primary: info1,
30
- success: success1,
31
- warning: warning1,
32
- danger: danger1
33
- },
34
- borderColor: {
35
- primary: theme.colors.info,
36
- success: theme.colors.success,
37
- warning: theme.colors.warning,
38
- danger: theme.colors.danger
8
+ import { color as colors } from '../../styles/colors';
9
+ import ButtonIcon from '../button/icon';
10
+ import * as Icons from '../../icons';
11
+ import { capitalize } from '../../utils';
12
+ import { hexToRGBA } from '../../styles/color-helper';
13
+ import { typography } from '../../styles/typography';
14
+ const {
15
+ heading3,
16
+ heading4,
17
+ heading5,
18
+ paragraph1,
19
+ paragraph2,
20
+ paragraph3
21
+ } = typography;
22
+ const {
23
+ system: {
24
+ rest
39
25
  },
40
- hover: {
41
- primary: info9,
42
- success: success9,
43
- warning: warning9,
44
- danger: danger9
26
+ semantic: {
27
+ success,
28
+ warning,
29
+ danger,
30
+ info
45
31
  }
46
- };
32
+ } = colors;
33
+ const colorMap = new Map([['info', info], ['success', success], ['warning', warning], ['danger', danger]]);
34
+ const iconMap = new Map([['info', 'Info'], ['success', 'ApprovalFilled'], ['warning', 'Warning'], ['danger', 'CancelFilled']]);
35
+ const maxWidthMap = new Map([['tiny', 320], ['small', 400], ['medium', 480]]);
36
+ const primaryTypoMap = new Map([['tiny', heading5], ['small', heading4], ['medium', heading3]]);
37
+ const iconSizeMap = new Map([['tiny', 16], ['small', 20], ['medium', 24]]);
38
+ const linearProgressSizeMap = new Map([['tiny', 2], ['small', 3], ['medium', 4]]);
47
39
  const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
48
40
  color,
49
41
  text,
@@ -62,6 +54,7 @@ const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
62
54
  }, ref) => {
63
55
  const clearIconRef = useRef(null);
64
56
  const [percentState, setPercentState] = useState(100);
57
+ const mainColor = colorMap.get(color);
65
58
  const AlertContainer = css`
66
59
  position: relative;
67
60
  display: block;
@@ -69,70 +62,60 @@ const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
69
62
  transition: opacity ${progressing ? duration / 2 + 1 : duration * 1}s ease ${progressing ? duration / 2 : 0}s;
70
63
  pointer-events: auto;
71
64
  z-index: 9001;
65
+ max-width: ${maxWidthMap.get(size)}px;
72
66
  `;
73
67
  const AlertInfo = css`
74
68
  display: flex;
75
69
  position: relative;
76
70
  width: 100%;
77
- min-width: 333px;
78
- border: 1px solid ${colors.borderColor[color]};
79
- color: ${colors.color[color]};
80
- background-color: ${colors.backgroundColor[color]};
71
+ min-width: 320px;
72
+ border: 1px solid ${mainColor};
73
+ color: ${mainColor};
74
+ background-color: ${hexToRGBA(mainColor, 0.15)};
81
75
  box-sizing: border-box;
82
76
  border-radius: 4px;
83
- padding: 8px 16px;
77
+ padding: 0 4px 0 16px;
84
78
  opacity: 1;
85
79
  word-break: break-word;
86
80
  `;
87
81
  const AlertIcon = css`
88
82
  display: inherit;
89
83
  margin-right: 10px;
90
- max-width: ${/^(small|sm)$/i.test(size) ? 16 : 24}px;
91
- max-height: ${/^(small|sm)$/i.test(size) ? 16 : 24}px;
84
+ padding: 8px 0;
92
85
  `;
93
86
  const AlertText = css`
94
87
  display: block;
95
- margin-right: 10px;
88
+ margin-right: ${clearAble ? '10px' : 0};
89
+ padding: 8px 0;
96
90
  `;
97
91
  const AlertPrimary = css`
98
92
  display: flex;
99
93
  position: relative;
100
94
  align-items: center;
101
95
  justify-content: flex-start;
102
- font-family: ${theme.typography.fontFamily};
103
- font-style: normal;
104
- font-weight: 500;
105
- font-size: ${/^(small|sm)$/i.test(size) ? 14 : 16}px;
106
- line-height: ${/^(small|sm)$/i.test(size) ? 16 : 24}px;
107
96
  user-select: none;
97
+ ${secondary ? primaryTypoMap.get(size) : paragraph1}
108
98
  `;
109
99
  const AlertSecondary = css`
110
100
  display: block;
111
- margin-right: 10px;
112
- font-family: ${theme.typography.fontFamily};
113
- font-style: normal;
114
- font-weight: 500;
115
- font-size: ${/^(small|sm)$/i.test(size) ? 12 : 14}px;
116
- line-height: 16px;
117
101
  user-select: none;
102
+ ${size === 'tiny' ? paragraph3 : paragraph2}
118
103
  `;
119
104
  const AlertClearIcon = css`
120
- display: inherit;
121
105
  margin-left: auto;
122
- color: ${colors.color[color]};
123
- cursor: pointer;
124
- max-width: ${/^(small|sm)$/i.test(size) ? 16 : 24}px;
125
- max-height: ${/^(small|sm)$/i.test(size) ? 16 : 24}px;
126
- &:hover {
127
- color: ${colors.hover[color]};
128
- }
129
106
  `;
130
107
  const linearProgressStyle = css`
131
108
  display: block;
132
109
  position: relative;
133
- margin-top: ${/^(small|sm)$/i.test(size) ? 2 : 6}px;
110
+ margin-top: ${size === 'medium' ? '4px' : '2px'};
134
111
  padding: 0 5px;
135
112
  `;
113
+ const NotFoundIcon = css`
114
+ display: block;
115
+ width: 70%;
116
+ height: 70%;
117
+ border: 1px dashed ${rest};
118
+ `;
136
119
 
137
120
  const onClearAlert = (el, urgency) => {
138
121
  var _el$parentNode;
@@ -157,37 +140,60 @@ const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
157
140
  }
158
141
  };
159
142
 
160
- const AlertView = useMemo(() => jsx("div", _extends({
161
- css: AlertInfo,
162
- className: ['DGN-UI-Alert', className].join(' ').trim()
163
- }, props), jsx("span", {
164
- css: AlertIcon
165
- }, icons[color]), jsx("span", {
166
- css: AlertText
167
- }, jsx("span", {
168
- css: AlertPrimary
169
- }, children ? typeof children === 'string' ? children : jsx("children", null) : text), secondary && jsx("span", {
170
- css: AlertSecondary
171
- }, secondary)), jsx("span", {
172
- css: AlertClearIcon,
173
- onClick: e => onClearAlert(e.currentTarget, true),
174
- ref: clearIconRef
175
- }, clearAble ? jsx(Close, {
176
- color: 'currentColor',
177
- height: /small/.test(size) ? 16 : 24,
178
- width: /small/.test(size) ? 16 : 24,
179
- viewBox: true
180
- }) : null)), [color, text, clearAble]);
143
+ const AlertView = useMemo(() => {
144
+ let node = children;
145
+
146
+ if (!node) {
147
+ const IconComp = Icons[capitalize(iconMap.get(color))];
148
+
149
+ if (IconComp) {
150
+ node = jsx(IconComp, {
151
+ width: iconSizeMap.get(size),
152
+ height: iconSizeMap.get(size),
153
+ color: 'currentColor',
154
+ viewBox: true
155
+ });
156
+ } else {
157
+ node = jsx("span", {
158
+ css: NotFoundIcon
159
+ });
160
+ }
161
+ }
162
+
163
+ return jsx("div", {
164
+ css: AlertInfo,
165
+ className: ['DGN-UI-Alert', className].join(' ').trim(),
166
+ ...props
167
+ }, jsx("span", {
168
+ css: AlertIcon
169
+ }, node), jsx("span", {
170
+ css: AlertText
171
+ }, jsx("span", {
172
+ css: AlertPrimary
173
+ }, children ? typeof children === 'string' ? children : jsx("children", null) : text), secondary && jsx("span", {
174
+ css: AlertSecondary
175
+ }, secondary)), jsx("span", {
176
+ css: AlertClearIcon,
177
+ onClick: e => onClearAlert(e.currentTarget, true),
178
+ ref: clearIconRef
179
+ }, clearAble ? jsx(ButtonIcon, {
180
+ circular: true,
181
+ viewType: 'text',
182
+ size: size,
183
+ color: color,
184
+ name: 'Close'
185
+ }) : null));
186
+ }, [color, text, clearAble, secondary, size]);
181
187
  const LinearView = useMemo(() => {
182
188
  return progressing ? jsx("span", {
183
189
  css: linearProgressStyle
184
190
  }, jsx(LinearProgress, {
185
191
  determinate: true,
186
192
  background: 'transparent',
187
- color: colors.color[color],
193
+ color: mainColor,
188
194
  percent: percentState,
189
195
  duration: duration,
190
- height: /^(small|sm)$/i.test(size) ? 2 : 4,
196
+ height: linearProgressSizeMap.get(size),
191
197
  style: {
192
198
  boxShadow: 'none'
193
199
  }
@@ -212,7 +218,7 @@ const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
212
218
  }, AlertView, LinearView);
213
219
  }));
214
220
  Alert.defaultProps = {
215
- color: 'primary',
221
+ color: 'info',
216
222
  size: 'medium',
217
223
  className: '',
218
224
  clearAble: true,
@@ -223,7 +229,7 @@ Alert.defaultProps = {
223
229
  };
224
230
  Alert.propTypes = {
225
231
  /** color is a string, it's background color of Alert */
226
- color: PropTypes.oneOf(['primary', 'success', 'warning', 'danger']),
232
+ color: PropTypes.oneOf(['info', 'success', 'warning', 'danger']),
227
233
 
228
234
  /** class for Alert component */
229
235
  className: PropTypes.string,
@@ -235,7 +241,7 @@ Alert.propTypes = {
235
241
  secondary: PropTypes.string,
236
242
 
237
243
  /** size is a string, size of Alert */
238
- size: PropTypes.oneOf(['small', 'medium']),
244
+ size: PropTypes.oneOf(['tiny', 'small', 'medium']),
239
245
 
240
246
  /** Display clear icon to close alert */
241
247
  clearAble: PropTypes.bool,
@@ -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
  import React, { memo, useEffect, forwardRef, useImperativeHandle } from 'react';
4
2
  import ReactDOM from 'react-dom';
5
3
  import PropTypes from 'prop-types';
@@ -119,15 +117,19 @@ const AlertNotify = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
119
117
  renderNotifyAlertPosition(position);
120
118
  }
121
119
 
122
- ReactDOM.render( /*#__PURE__*/React.createElement(Alert, _extends({
120
+ ReactDOM.render( /*#__PURE__*/React.createElement(Alert, {
123
121
  onClose: e => onClose(e, position),
124
- usedByNotify: true
125
- }, props, options), message), document.querySelector(`div[class^="Notify-Alert-${position.vertical}-${position.horizontal}"]`).appendChild(el));
122
+ usedByNotify: true,
123
+ ...props,
124
+ ...options
125
+ }, message), document.querySelector(`div[class^="Notify-Alert-${position.vertical}-${position.horizontal}"]`).appendChild(el));
126
126
  } else {
127
- ReactDOM.render( /*#__PURE__*/React.createElement(Alert, _extends({
127
+ ReactDOM.render( /*#__PURE__*/React.createElement(Alert, {
128
128
  onClose: onClose,
129
- usedByNotify: true
130
- }, props, options), message), document.querySelector(`div[class^="Notify-Alert-"]`).appendChild(el));
129
+ usedByNotify: true,
130
+ ...props,
131
+ ...options
132
+ }, message), document.querySelector(`div[class^="Notify-Alert-"]`).appendChild(el));
131
133
  }
132
134
  };
133
135
 
@@ -1,13 +1,11 @@
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
4
  import { Fragment, memo, useRef, forwardRef, useState, useEffect, useMemo } from 'react';
7
5
  import PropTypes from 'prop-types';
8
6
  import { jsx, css } from '@emotion/core';
9
- import Icon, { Account } from '../../icons';
10
- import { ModalSample, Popover, Popup, Typography } from '../';
7
+ import { Account } from '../../icons';
8
+ import { ButtonIcon, ModalSample, Popover, Popup, Typography } from '../';
11
9
  import { randomString } from '../../utils';
12
10
  import { getGlobal } from '../../global';
13
11
  const existed = {},
@@ -131,8 +129,8 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
131
129
  width = height;
132
130
  }
133
131
 
134
- const iconDefault = `<svg width="${width}" height="${height}" viewBox="0 0 20 20" fill="none">
135
- <path fill-rule="evenodd" clip-rule="evenodd" d="M10 0C4.47998 0 0 4.48 0 10C0 15.52 4.47998 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM10 3C11.66 3 13 4.34 13 6C13 7.66 11.66 9 10 9C8.34003 9 7 7.66 7 6C7 4.34 8.34003 3 10 3ZM4 13.98C5.28998 15.92 7.5 17.2 10 17.2C12.5 17.2 14.71 15.92 16 13.98C15.97 11.99 11.99 10.9 10 10.9C8 10.9 4.03003 11.99 4 13.98Z" fill="#7F828E"/>
132
+ const iconDefault = `<svg width="${width}" height="${height}" viewBox="0 0 24 24" fill="none">
133
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 2C6.47998 2 2 6.48 2 12C2 17.52 6.47998 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 5C13.66 5 15 6.34 15 8C15 9.66 13.66 11 12 11C10.34 11 9 9.66 9 8C9 6.34 10.34 5 12 5ZM6 15.98C7.28998 17.92 9.5 19.2 12 19.2C14.5 19.2 16.71 17.92 18 15.98C17.97 13.99 13.99 12.9 12 12.9C10 12.9 6.03003 13.99 6 15.98Z" fill="#7F828E"></path>
136
134
  </svg>`;
137
135
  const ActionIcon = css`
138
136
  position: absolute;
@@ -341,7 +339,7 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
341
339
  if (defaultSrc) {
342
340
  e.target.src = defaultSrc;
343
341
  } else {
344
- ref.current.querySelector(`.css-${AvatarPreview.name}`).innerHTML = iconDefault;
342
+ if (ref.current) ref.current.querySelector(`.css-${AvatarPreview.name}`).innerHTML = iconDefault;
345
343
  }
346
344
  };
347
345
 
@@ -384,10 +382,11 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
384
382
  css: AvatarContainer,
385
383
  ref: ref,
386
384
  id: unique
387
- }, jsx("div", _extends({
385
+ }, jsx("div", {
388
386
  css: AvatarRoot,
389
- className: ['DGN-UI-Avatar', className].join(' ').trim()
390
- }, props), jsx("input", {
387
+ className: ['DGN-UI-Avatar', className].join(' ').trim(),
388
+ ...props
389
+ }, jsx("input", {
391
390
  ref: inputRef,
392
391
  type: "file",
393
392
  title: '',
@@ -413,13 +412,15 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
413
412
  viewBox: true
414
413
  }))), !readOnly && !disabled && jsx("span", {
415
414
  css: ActionIcon
416
- }, jsx(Icon, {
415
+ }, jsx(ButtonIcon, {
416
+ viewType: 'ghost',
417
417
  name: 'Edit',
418
418
  width: actionIconWidth,
419
419
  height: actionIconHeight,
420
420
  className: 'icon-edit',
421
421
  onClick: () => triggerInput()
422
- }), clearAble && jsx(Icon, {
422
+ }), clearAble && jsx(ButtonIcon, {
423
+ viewType: 'ghost',
423
424
  name: 'Delete',
424
425
  width: actionIconWidth,
425
426
  height: actionIconHeight,
@@ -444,14 +445,15 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
444
445
  display: 'block'
445
446
  }
446
447
  })), [viewAvatar]);
447
- const MoreInfoView = useMemo(() => jsx(Popover, _extends({
448
+ const MoreInfoView = useMemo(() => jsx(Popover, {
448
449
  open: viewMoreInfo,
449
450
  pressESCToClose: false,
450
451
  bgColor: '#000',
451
452
  anchor: avatarRef,
452
453
  fullScreen: false,
453
- width: 'max-content'
454
- }, getDirection(direction)), jsx("div", {
454
+ width: 'max-content',
455
+ ...getDirection(direction)
456
+ }, jsx("div", {
455
457
  css: MoreInfo
456
458
  }, typeof data === 'function' ? data() : renderData())), [viewMoreInfo, direction, data]);
457
459
  const PopupView = useMemo(() => jsx(Popup, {
@@ -471,8 +473,8 @@ Avatar.defaultProps = {
471
473
  outlined: false,
472
474
  width: 48,
473
475
  height: 48,
474
- actionIconWidth: 18,
475
- actionIconHeight: 18,
476
+ actionIconWidth: '100%',
477
+ actionIconHeight: '100%',
476
478
  className: '',
477
479
  direction: 'down',
478
480
  maxSizeError: `File ${getGlobal(['errorDefault', 'maxSize'])}`,