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, useState, useEffect, useRef, useImperativeHandle, forwardRef, Fragment } from 'react';
5
4
  import { createPortal } from 'react-dom';
@@ -59,8 +58,8 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
59
58
  allowSymbol: false
60
59
  }));
61
60
  const [open, setOpen] = useState(false);
62
- /* Start handler */
63
61
 
62
+ /* Start handler */
64
63
  const onTriggerDropdown = e => {
65
64
  if (!open) {
66
65
  openDropdownBox();
@@ -69,19 +68,16 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
69
68
  e.currentTarget.blur();
70
69
  }
71
70
  };
72
-
73
71
  const onClickOutsideOfInput = event => {
74
72
  if (ref.current && !ref.current.contains(event.target) && dropdownBoxRef.current && !dropdownBoxRef.current.contains(event.target)) {
75
73
  closeDropdownBox();
76
74
  }
77
75
  };
78
-
79
76
  const pressESCHandler = event => {
80
77
  if (event.key === 'Escape') {
81
78
  closeDropdownBox();
82
79
  }
83
80
  };
84
-
85
81
  const openDropdownBox = () => {
86
82
  setOpen(true);
87
83
  setTimeout(() => {
@@ -99,16 +95,12 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
99
95
  !!onOpened && onOpened(ref.current);
100
96
  }, 10);
101
97
  };
102
-
103
98
  const closeDropdownBox = certain => {
104
99
  var _Array$from, _Array$from$classList;
105
-
106
100
  const portals = document.querySelectorAll('.DGN-UI-Portal');
107
-
108
101
  if (!certain && portals && portals.length > 1 && Array.from(portals)[portals.length - 1] && !Array.from(portals)[portals.length - 1].contains(ref.current) && !((_Array$from = Array.from(portals)[portals.length - 1]) !== null && _Array$from !== void 0 && (_Array$from$classList = _Array$from.classList) !== null && _Array$from$classList !== void 0 && _Array$from$classList.contains('DGN-UI-Modal'))) {
109
102
  return;
110
103
  }
111
-
112
104
  if (dropdownBoxRef.current) {
113
105
  dropdownBoxRef.current.style.pointerEvents = `none`;
114
106
  dropdownBoxRef.current.style.opacity = 0;
@@ -121,7 +113,6 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
121
113
  }, 300);
122
114
  }
123
115
  };
124
-
125
116
  useEffect(() => {
126
117
  return () => {
127
118
  closeDropdownBox();
@@ -137,7 +128,6 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
137
128
  closeDropdownBox(true);
138
129
  }
139
130
  }));
140
-
141
131
  const renderEndIcon = () => {
142
132
  return endIcon && jsx(ButtonIcon, {
143
133
  viewType: 'ghost',
@@ -145,14 +135,15 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
145
135
  onClick: openOnClickAt === 'icon' ? onTriggerDropdown : null
146
136
  });
147
137
  };
148
-
149
138
  return jsx(Fragment, null, jsx("div", {
150
139
  ref: ref,
151
140
  css: DropdownBoxRootCSS(bgColor),
152
141
  className: ['DGN-UI-Dropdown-Box', open && 'dropdown-showing', className].join(' ').trim().replace(/\s+/g, ' '),
153
142
  style: style
154
- }, label ? jsx(Label, { ...labelProps
155
- }, label) : null, jsx(InputBase, { ...inputProps,
143
+ }, label ? jsx(Label, {
144
+ ...labelProps
145
+ }, label) : null, jsx(InputBase, {
146
+ ...inputProps,
156
147
  className: open ? 'dropdown-focus' : '',
157
148
  style: inputStyle,
158
149
  viewType: viewType,
@@ -170,8 +161,8 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
170
161
  css: DropdownBoxCSS(zIndex)
171
162
  }, children), document.body));
172
163
  }));
173
- /* Start styled */
174
164
 
165
+ /* Start styled */
175
166
  const DropdownBoxRootCSS = bgColor => css`
176
167
  &.DGN-UI-Dropdown-Box {
177
168
  ${displayBlock}
@@ -201,7 +192,6 @@ const DropdownBoxRootCSS = bgColor => css`
201
192
  }
202
193
  }
203
194
  `;
204
-
205
195
  const DropdownBoxCSS = zIndex => css`
206
196
  ${displayBlock};
207
197
  ${paragraph1};
@@ -235,7 +225,6 @@ const DropdownBoxCSS = zIndex => css`
235
225
  `;
236
226
  /* End styled */
237
227
 
238
-
239
228
  DropdownBox.defaultProps = {
240
229
  className: '',
241
230
  label: '',
@@ -251,58 +240,40 @@ DropdownBox.defaultProps = {
251
240
  DropdownBox.propTypes = {
252
241
  /** class for dropdown */
253
242
  className: PropTypes.string,
254
-
255
243
  /** label for input */
256
244
  label: PropTypes.string,
257
-
258
245
  /** hints for input */
259
246
  placeholder: PropTypes.string,
260
-
261
247
  /** the content to display in input */
262
248
  value: PropTypes.string,
263
-
264
249
  /** icon at start */
265
250
  startIcon: PropTypes.string,
266
-
267
251
  /** icon at end */
268
252
  endIcon: PropTypes.string,
269
-
270
253
  /** background color of DropdownBox input */
271
254
  bgColor: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
272
-
273
255
  /** viewType of InputBase */
274
256
  viewType: PropTypes.oneOf(['underlined', 'outlined']),
275
-
276
257
  /** viewType of InputBase */
277
258
  openOnClickAt: PropTypes.oneOf(['full', 'icon']),
278
-
279
259
  /** style inline for dropdown */
280
260
  style: PropTypes.object,
281
-
282
261
  /** props of input in DropdownBox component */
283
262
  inputProps: PropTypes.object,
284
-
285
263
  /** style inline of input in DropdownBox component */
286
264
  inputStyle: PropTypes.object,
287
-
288
265
  /** the function will run when entering input */
289
266
  onChangeInput: PropTypes.func,
290
-
291
267
  /** delay time on input */
292
268
  delayOnInput: PropTypes.number,
293
-
294
269
  /** style inline of label in DropdownBox component */
295
270
  labelProps: PropTypes.object,
296
-
297
271
  /** z-index for DropdownBox component */
298
272
  zIndex: PropTypes.number,
299
-
300
273
  /** the contents in DropdownBox box (Exp: TreeView) */
301
274
  children: PropTypes.node.isRequired,
302
-
303
275
  /** the function will run after open */
304
276
  onOpened: PropTypes.func,
305
-
306
277
  /** the function will run after close */
307
278
  onClosed: PropTypes.func
308
279
  };
@@ -13,13 +13,11 @@ const Form = /*#__PURE__*/forwardRef(({
13
13
  if (!ref) {
14
14
  ref = useRef(null);
15
15
  }
16
-
17
16
  const submitHandler = e => {
18
17
  e.preventDefault();
19
18
  !!onValidate && onValidate();
20
19
  !!onSubmit && onSubmit(e);
21
20
  };
22
-
23
21
  useEffect(() => {
24
22
  !!onLoaded && onLoaded(ref.current);
25
23
  }, []);
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useRef, useEffect, forwardRef, Children, useImperativeHandle } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -18,8 +17,8 @@ const FormGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
18
17
  }, reference) => {
19
18
  const ref = useRef(null);
20
19
  const previousError = useRef(false);
21
- /* Start styled */
22
20
 
21
+ /* Start styled */
23
22
  const FormGroupRoot = css`
24
23
  position: relative;
25
24
  align-items: flex-end;
@@ -59,11 +58,9 @@ const FormGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
59
58
  /* End styled */
60
59
 
61
60
  /* Start handler */
62
-
63
61
  const resetLabelPosition = () => {
64
62
  const allUnderlined = ref.current.querySelectorAll('.DGN-UI-InputBase.underlined');
65
63
  const outlined = ref.current.querySelector('.DGN-UI-InputBase.outlined');
66
-
67
64
  if (allUnderlined.length && outlined) {
68
65
  allUnderlined.forEach(input => {
69
66
  if (input.previousElementSibling) {
@@ -72,7 +69,6 @@ const FormGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
72
69
  });
73
70
  }
74
71
  };
75
-
76
72
  useEffect(() => {
77
73
  if (ref.current) {
78
74
  resetLabelPosition();
@@ -86,7 +82,6 @@ const FormGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
86
82
  isError = true;
87
83
  }
88
84
  });
89
-
90
85
  if (previousError.current !== isError) {
91
86
  previousError.current = isError;
92
87
  ref.current.querySelectorAll('.DGN-UI-TextInput, .DGN-UI-Dropdown, .DGN-UI-InputBase').forEach(node => {
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { css, jsx } from '@emotion/core';
5
4
  import PropTypes from 'prop-types';
@@ -38,11 +37,10 @@ const HelperText = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
38
37
  useImperativeHandle(reference, () => {
39
38
  const currentRef = ref.current || {};
40
39
  currentRef.element = ref.current;
41
- const _instance = { ...action
40
+ const _instance = {
41
+ ...action
42
42
  }; // methods
43
-
44
43
  _instance.__proto__ = {}; // hidden methods
45
-
46
44
  currentRef.instance = _instance;
47
45
  return currentRef;
48
46
  });
@@ -72,19 +70,14 @@ HelperText.defaultProps = {
72
70
  HelperText.propTypes = {
73
71
  /** If true, the component is disabled. */
74
72
  disabled: PropTypes.bool,
75
-
76
73
  /** status type to display color for input (only available for type is inform) */
77
74
  status: PropTypes.oneOf(['default', 'warning', 'success', 'danger', 'info']),
78
-
79
75
  /** Class for component. */
80
76
  className: PropTypes.string,
81
-
82
77
  /** Style inline of component. */
83
78
  style: PropTypes.object,
84
-
85
79
  /** Content to display in component. */
86
80
  children: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
87
-
88
81
  /** [Props](https://core.diginet.com.vn/ui/?path=/docs/typography) of Typography */
89
82
  props: PropTypes.any
90
83
  };