diginet-core-ui 1.3.34 → 1.3.35

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 (39) hide show
  1. package/assets/images/menu/dhr/MHRP09N0032.svg +7 -0
  2. package/components/avatar/index.js +19 -19
  3. package/components/badge/index.js +61 -64
  4. package/components/button/icon.js +21 -21
  5. package/components/button/index.js +180 -180
  6. package/components/button/ripple-effect.js +23 -23
  7. package/components/chart/Pie-v2/index.js +40 -42
  8. package/components/chip/index.js +129 -134
  9. package/components/form-control/attachment/index.js +431 -435
  10. package/components/form-control/calendar/function.js +69 -46
  11. package/components/form-control/calendar/index.js +12 -3
  12. package/components/form-control/control/index.js +35 -23
  13. package/components/form-control/date-picker/index.js +36 -36
  14. package/components/form-control/date-range-picker/index.js +84 -86
  15. package/components/form-control/dropdown/index.js +462 -431
  16. package/components/form-control/dropdown-box/index.js +53 -53
  17. package/components/form-control/label/index.js +16 -15
  18. package/components/form-control/money-input/index.js +106 -7
  19. package/components/form-control/radio/index.js +129 -132
  20. package/components/form-control/text-input/index.js +25 -28
  21. package/components/form-control/toggle/index.js +106 -107
  22. package/components/modal/modal.js +43 -46
  23. package/components/popover/index.js +27 -29
  24. package/components/popup/index.js +73 -77
  25. package/components/popup/proposals_popup.js +46 -48
  26. package/components/popup/v2/index.js +108 -110
  27. package/components/progress/circular.js +65 -66
  28. package/components/tab/tab-container.js +32 -14
  29. package/components/tab/tab-header.js +81 -56
  30. package/components/tab/tab-panel.js +46 -17
  31. package/components/tab/tab.js +105 -87
  32. package/components/tooltip/index.js +24 -26
  33. package/components/typography/index.js +10 -10
  34. package/icons/basic.js +148 -27
  35. package/icons/effect.js +26 -26
  36. package/package.json +1 -1
  37. package/readme.md +17 -0
  38. package/theme/settings.js +7 -5
  39. package/utils/number.js +11 -12
@@ -81,27 +81,27 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
81
81
  /* Start styled */
82
82
 
83
83
  const TextInputRoot = css`
84
- display: block;
85
- position: relative;
86
- margin-bottom: 20px;
87
- `;
84
+ display: block;
85
+ position: relative;
86
+ margin-bottom: 20px;
87
+ `;
88
88
  const TextInputIcon = css`
89
- display: flex;
90
- color: inherit;
91
- .edit-icon-pen {
92
- display: flex;
93
- }
94
- .edit-icon-confirm {
95
- display: none;
96
- }
97
- .edit-icon-clear {
98
- display: none;
99
- margin-left: 12px;
100
- }
101
- .circular {
102
- display: none;
103
- }
104
- `;
89
+ display: flex;
90
+ color: inherit;
91
+ .edit-icon-pen {
92
+ display: flex;
93
+ }
94
+ .edit-icon-confirm {
95
+ display: none;
96
+ }
97
+ .edit-icon-clear {
98
+ display: none;
99
+ margin-left: 12px;
100
+ }
101
+ .circular {
102
+ display: none;
103
+ }
104
+ `;
105
105
  /* End styled */
106
106
 
107
107
  /* Start handler */
@@ -117,8 +117,6 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
117
117
  target: null
118
118
  });
119
119
  }
120
-
121
- ;
122
120
  };
123
121
 
124
122
  const onFocusInput = () => {
@@ -158,7 +156,6 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
158
156
  return;
159
157
  }
160
158
 
161
- ;
162
159
  currentValue = value;
163
160
  if (onConfirm) onConfirm({
164
161
  value
@@ -207,7 +204,7 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
207
204
  }, [type, multiline]);
208
205
  useEffect(() => {
209
206
  if (/inform/i.test(type) && !multiline) {
210
- const regexp = /(success)|(warning)|(danger)/ig;
207
+ const regexp = /(success)|(warning)|(danger)/gi;
211
208
  const existedClass = ref.current.classList.value.match(regexp);
212
209
 
213
210
  if (existedClass) {
@@ -500,10 +497,10 @@ TextInput.propTypes = {
500
497
  /** on focus function */
501
498
  onFocus: PropTypes.func,
502
499
 
503
- /** validation value, argument can:<br/>
504
- * * string: the validation rule. Example required.<br/>
505
- * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
506
- * * array: the validation rule list, insist object/string
500
+ /** validation value, argument can:<br/>
501
+ * * string: the validation rule. Example required.<br/>
502
+ * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
503
+ * * array: the validation rule list, insist object/string
507
504
  */
508
505
  validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
509
506
 
@@ -37,109 +37,108 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
37
37
  }
38
38
 
39
39
  const formCheck = css`
40
- position: relative;
41
- cursor: pointer;
42
- user-select: none;
43
- padding-left: 3px;
44
- &.disabled {
45
- pointer-events: none;
46
- }
47
- `;
40
+ position: relative;
41
+ cursor: pointer;
42
+ user-select: none;
43
+ padding-left: 3px;
44
+ &.disabled {
45
+ pointer-events: none;
46
+ }
47
+ `;
48
48
  const toggle = css`
49
- display:flex;
50
- align-items: center;
51
- cursor: pointer;
52
- position: relative;
53
- box-sizing: border-box;
54
- margin: 0;
55
- `;
49
+ display: flex;
50
+ align-items: center;
51
+ cursor: pointer;
52
+ position: relative;
53
+ box-sizing: border-box;
54
+ margin: 0;
55
+ `;
56
56
  const slider = css`
57
- position: relative;
58
- cursor: pointer;
59
- display: block;
60
- height: ${height}px;
61
- width: ${width}px;
62
- border-radius: ${height}px;
63
- background: white;
64
- border: 1px solid ${theme.colors.border};
65
- margin: 0px auto;
66
- &::after {
67
- content: '';
68
- box-sizing: border-box;
69
- position: absolute;
70
- border-radius: 100%;
71
- left: 3%;
72
- z-index: 2;
73
- background: ${theme.colors.border};
74
- transition: 0.3s ease-in-out;
75
- top: 49%;
76
- transform: translateY(-49%);
77
- margin: 0px auto;
78
- width: ${width / 12 * 5}px;
79
- height: ${width / 12 * 5}px;
80
- }
81
- &:hover {
82
- box-shadow:
83
- 0 0 2px 2px ${theme.colors.focus};
84
- background-color:${theme.colors.focus};
85
- border: 1px solid ${theme.colors.primary};
86
- }
87
- `;
88
- const checkbox = css`
89
- box-sizing: border-box;
90
- left: 0;
91
- top: 50%;
92
- z-index: 2;
93
- &:checked + label > span.css-${slider.name} {
94
- border: none;
95
- background: ${theme.colors.primary};
96
- border: 1px solid transparent;
97
- transition: 0.3s ease-in-out;
98
- box-shadow:
99
- 0 0 2px 2px ${theme.colors.focus};
100
- &::after {
101
- transform: translate(${height}px, -50%);
57
+ position: relative;
58
+ cursor: pointer;
59
+ display: block;
60
+ height: ${height}px;
61
+ width: ${width}px;
62
+ border-radius: ${height}px;
102
63
  background: white;
103
- }
104
- }
105
- &:hover:checked + label > span.css-${slider.name} {
106
- border: none;
107
- background: ${theme.colors.primary};
108
- border: 1px solid transparent;
109
- &::after {
110
- background: ${theme.colors.hover};
111
- }
112
- }
113
- &:disabled:checked + label > span.css-${slider.name} {
114
- user-select: none;
115
- pointer-events: none;
116
- cursor: not-allowed;
117
- border: none;
118
- background: ${theme.colors.disabled};
119
- border: 1px solid transparent;
120
- box-shadow: initial;
121
- &::after {
122
- background: ${theme.colors.dark12};
123
- }
124
- }
125
- &:hover:not(:checked) + label > span.css-${slider.name} {
126
- background: ${theme.colors.hover};
127
- border: 1px solid ${theme.colors.primary};
128
- transition: 0.3s ease-in-out;
129
- ::after{
130
- background: ${theme.colors.primary};
131
- }
132
- }
133
- &:disabled:not(:checked) + label > span.css-${slider.name} {
134
- background: ${theme.colors.dark12};
135
- cursor: not-allowed;
136
- user-select: none;
137
- border: 1px solid ${theme.colors.disabled};
138
- pointer-events: none;
139
- ::after{
140
- background: ${theme.colors.disabled};
141
- }
142
- }`;
64
+ border: 1px solid ${theme.colors.border};
65
+ margin: 0px auto;
66
+ &::after {
67
+ content: '';
68
+ box-sizing: border-box;
69
+ position: absolute;
70
+ border-radius: 100%;
71
+ left: 3%;
72
+ z-index: 2;
73
+ background: ${theme.colors.border};
74
+ transition: 0.3s ease-in-out;
75
+ top: 49%;
76
+ transform: translateY(-49%);
77
+ margin: 0px auto;
78
+ width: ${width / 12 * 5}px;
79
+ height: ${width / 12 * 5}px;
80
+ }
81
+ &:hover {
82
+ box-shadow: 0 0 2px 2px ${theme.colors.focus};
83
+ background-color: ${theme.colors.focus};
84
+ border: 1px solid ${theme.colors.primary};
85
+ }
86
+ `;
87
+ const checkbox = css`
88
+ box-sizing: border-box;
89
+ left: 0;
90
+ top: 50%;
91
+ z-index: 2;
92
+ &:checked + label > span.css-${slider.name} {
93
+ border: none;
94
+ background: ${theme.colors.primary};
95
+ border: 1px solid transparent;
96
+ transition: 0.3s ease-in-out;
97
+ box-shadow: 0 0 2px 2px ${theme.colors.focus};
98
+ &::after {
99
+ transform: translate(${height}px, -50%);
100
+ background: white;
101
+ }
102
+ }
103
+ &:hover:checked + label > span.css-${slider.name} {
104
+ border: none;
105
+ background: ${theme.colors.primary};
106
+ border: 1px solid transparent;
107
+ &::after {
108
+ background: ${theme.colors.hover};
109
+ }
110
+ }
111
+ &:disabled:checked + label > span.css-${slider.name} {
112
+ user-select: none;
113
+ pointer-events: none;
114
+ cursor: not-allowed;
115
+ border: none;
116
+ background: ${theme.colors.disabled};
117
+ border: 1px solid transparent;
118
+ box-shadow: initial;
119
+ &::after {
120
+ background: ${theme.colors.dark12};
121
+ }
122
+ }
123
+ &:hover:not(:checked) + label > span.css-${slider.name} {
124
+ background: ${theme.colors.hover};
125
+ border: 1px solid ${theme.colors.primary};
126
+ transition: 0.3s ease-in-out;
127
+ ::after {
128
+ background: ${theme.colors.primary};
129
+ }
130
+ }
131
+ &:disabled:not(:checked) + label > span.css-${slider.name} {
132
+ background: ${theme.colors.dark12};
133
+ cursor: not-allowed;
134
+ user-select: none;
135
+ border: 1px solid ${theme.colors.disabled};
136
+ pointer-events: none;
137
+ ::after {
138
+ background: ${theme.colors.disabled};
139
+ }
140
+ }
141
+ `;
143
142
  const idDefault = generateRandom(10, {
144
143
  allowNumber: false,
145
144
  allowSymbol: false
@@ -222,9 +221,9 @@ Toggle.propTypes = {
222
221
  /** Id is randomized randomly to avoid duplication. */
223
222
  id: PropTypes.string,
224
223
 
225
- /**
226
- * Name attribute of the `input` element.
227
- */
224
+ /**
225
+ * Name attribute of the `input` element.
226
+ */
228
227
  name: PropTypes.string,
229
228
 
230
229
  /** The name of the Radio is displayed on the interface */
@@ -239,10 +238,10 @@ Toggle.propTypes = {
239
238
  /** props for input */
240
239
  inputProps: PropTypes.object,
241
240
 
242
- /** * Callback fired when the state is changed.
243
- *
244
- * @param {object} event The event source of the callback.
245
- * You can pull out the new checked state by accessing `event.target.checked` (boolean).
241
+ /** * Callback fired when the state is changed.
242
+ *
243
+ * @param {object} event The event source of the callback.
244
+ * You can pull out the new checked state by accessing `event.target.checked` (boolean).
246
245
  */
247
246
  onChange: PropTypes.func
248
247
  };
@@ -35,20 +35,20 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
35
35
  const modalBoxRef = useRef(null);
36
36
  const [openState, setOpenState] = useState(open);
37
37
  const ModalContainer = css`
38
- position: fixed;
39
- display: flex;
40
- width: 100%;
41
- height: 100vh;
42
- background-color: ${darkTheme ? 'rgba(21, 26, 48, 0.5)' : 'transparent'};
43
- top: 0;
44
- left: 0;
45
- justify-content: center;
46
- align-items: ${top ? 'inherit' : 'center'};
47
- padding-top: ${top ? isNaN(top) ? top : top + 'px' : 0};
48
- opacity: 0;
49
- transition: opacity 0.3s ease;
50
- z-index: ${zIndex};
51
- `;
38
+ position: fixed;
39
+ display: flex;
40
+ width: 100%;
41
+ height: 100vh;
42
+ background-color: ${darkTheme ? 'rgba(21, 26, 48, 0.5)' : 'transparent'};
43
+ top: 0;
44
+ left: 0;
45
+ justify-content: center;
46
+ align-items: ${top ? 'inherit' : 'center'};
47
+ padding-top: ${top ? isNaN(top) ? top : top + 'px' : 0};
48
+ opacity: 0;
49
+ transition: opacity 0.3s ease;
50
+ z-index: ${zIndex};
51
+ `;
52
52
  const fadeInDown = keyframes`
53
53
  0% {
54
54
  opacity: 0;
@@ -72,31 +72,31 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
72
72
  }
73
73
  `;
74
74
  const ModalBox = css`
75
- display: flex;
76
- flex-direction: column;
77
- position: relative;
78
- background-color: white;
79
- ${typography.paragraph1};
80
- height: max-content;
81
- max-height: calc(100% - ${isNaN(top) ? top : +top + 'px'});
82
- min-width: 150px;
83
- max-width: 90%;
84
- /* min-height: 152px; */
85
- margin: 0 auto;
86
- border-radius: 4px;
87
- box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
88
- box-sizing: border-box;
89
- -webkit-box-orient: vertical;
90
- -webkit-box-direction: normal;
91
- width: ${isNaN(width) ? width : width + 'px'};
92
- animation: ${fadeOutUp} 0.2s ease;
93
- animation-fill-mode: forwards;
94
- cursor: ${moveable && dragAnyWhere ? 'move' : 'initial'};
95
- &.show {
96
- display: flex !important;
97
- animation: ${fadeInDown} 0.2s ease;
98
- }
99
- `;
75
+ display: flex;
76
+ flex-direction: column;
77
+ position: relative;
78
+ background-color: white;
79
+ ${typography.paragraph1};
80
+ height: max-content;
81
+ max-height: calc(100% - ${isNaN(top) ? top : +top + 'px'});
82
+ min-width: 150px;
83
+ max-width: 90%;
84
+ /* min-height: 152px; */
85
+ margin: 0 auto;
86
+ border-radius: 4px;
87
+ box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
88
+ box-sizing: border-box;
89
+ -webkit-box-orient: vertical;
90
+ -webkit-box-direction: normal;
91
+ width: ${isNaN(width) ? width : width + 'px'};
92
+ animation: ${fadeOutUp} 0.2s ease;
93
+ animation-fill-mode: forwards;
94
+ cursor: ${moveable && dragAnyWhere ? 'move' : 'initial'};
95
+ &.show {
96
+ display: flex !important;
97
+ animation: ${fadeInDown} 0.2s ease;
98
+ }
99
+ `;
100
100
 
101
101
  const onShowModal = () => {
102
102
  setOpenState(true);
@@ -108,7 +108,6 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
108
108
  setOpenState(false);
109
109
  }, 500);
110
110
  }
111
- ;
112
111
 
113
112
  if (pressESCToClose) {
114
113
  document.removeEventListener('keydown', pressESCHandler);
@@ -130,8 +129,6 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
130
129
 
131
130
  onCloseModal();
132
131
  }
133
-
134
- ;
135
132
  };
136
133
 
137
134
  const dragMouseDown = e => {
@@ -150,8 +147,8 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
150
147
  modalBoxRef.current.style.display = 'block';
151
148
  modalBoxRef.current.style.position = 'absolute';
152
149
  modalBoxRef.current.style.margin = '0px';
153
- modalBoxRef.current.style.top = top + "px";
154
- modalBoxRef.current.style.left = left + "px";
150
+ modalBoxRef.current.style.top = top + 'px';
151
+ modalBoxRef.current.style.left = left + 'px';
155
152
  }
156
153
 
157
154
  document.onmouseup = () => {
@@ -184,8 +181,8 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
184
181
  } // set the element's new position:
185
182
 
186
183
 
187
- modalBoxRef.current.style.top = newTop + "px";
188
- modalBoxRef.current.style.left = newLeft + "px";
184
+ modalBoxRef.current.style.top = newTop + 'px';
185
+ modalBoxRef.current.style.left = newLeft + 'px';
189
186
  };
190
187
  };
191
188
 
@@ -33,39 +33,39 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
33
33
  const [openState, setOpenState] = useState(open);
34
34
  const [element, setElement] = useState(null);
35
35
  const PopoverContainer = css`
36
- ${flexRow}
37
- ${positionFixed}
36
+ ${flexRow}
37
+ ${positionFixed}
38
38
  width: ${isNaN(width) ? width : width + 'px'};
39
- max-width: 100%;
40
- max-height: 100%;
41
- height: ${isNaN(height) ? height : height + 'px'};
42
- z-index: 1000;
43
- transform: scale(0);
44
- transition: transform 0.2s linear;
45
- pointer-events: initial;
46
- &.open {
47
- transform: scale(1);
48
- }
49
- `;
39
+ max-width: 100%;
40
+ max-height: 100%;
41
+ height: ${isNaN(height) ? height : height + 'px'};
42
+ z-index: 1000;
43
+ transform: scale(0);
44
+ transition: transform 0.2s linear;
45
+ pointer-events: initial;
46
+ &.open {
47
+ transform: scale(1);
48
+ }
49
+ `;
50
50
  const PopoverRoot = css`
51
- ${displayBlock}
52
- ${positionRelative}
51
+ ${displayBlock}
52
+ ${positionRelative}
53
53
  ${borderRadius4px}
54
54
  ${paragraph1};
55
- background-color: ${bgColor};
56
- width: 100%;
57
- height: 100%;
58
- box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
59
- `;
55
+ background-color: ${bgColor};
56
+ width: 100%;
57
+ height: 100%;
58
+ box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
59
+ `;
60
60
  const PopoverArrow = css`
61
- ${displayBlock}
62
- ${positionAbsolute}
61
+ ${displayBlock}
62
+ ${positionAbsolute}
63
63
  height: 0;
64
- width: 0;
65
- border-left: 6px solid transparent;
66
- border-right: 6px solid transparent;
67
- border-bottom: 6px solid ${bgColor};
68
- `;
64
+ width: 0;
65
+ border-left: 6px solid transparent;
66
+ border-right: 6px solid transparent;
67
+ border-bottom: 6px solid ${bgColor};
68
+ `;
69
69
 
70
70
  const onClosePopover = () => {
71
71
  // const popovers = document.querySelectorAll('.DGN-UI-Portal');
@@ -82,8 +82,6 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
82
82
  if (event.key === 'Escape') {
83
83
  onClosePopover();
84
84
  }
85
-
86
- ;
87
85
  };
88
86
 
89
87
  const clickOutOfPopover = event => {