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 { jsx, css } from '@emotion/core';
5
4
  import PropTypes from 'prop-types';
@@ -14,16 +13,13 @@ import { useTheme } from '../../../theme';
14
13
  const {
15
14
  zIndex
16
15
  } = useTheme();
17
-
18
16
  const formatDimension = x => {
19
17
  const regexPercent = /^\d+%$/;
20
18
  const regexPixel = /^\d+px$/;
21
-
22
19
  if (isNaN(x)) {
23
20
  if (regexPercent.test(x)) {
24
21
  return x;
25
22
  }
26
-
27
23
  if (regexPixel.test(x)) {
28
24
  return +x.split('px')[0];
29
25
  }
@@ -31,7 +27,6 @@ const formatDimension = x => {
31
27
  return x;
32
28
  }
33
29
  };
34
-
35
30
  const addZero = i => {
36
31
  if (isNaN(i) && +i < 10) {
37
32
  return `0${parseInt(i, 10)}`;
@@ -40,45 +35,36 @@ const addZero = i => {
40
35
  } else {
41
36
  return i;
42
37
  }
43
- }; //array data
44
-
45
-
38
+ };
39
+ //array data
46
40
  const getHours = () => {
47
41
  let hours = [],
48
- i = 0;
49
-
42
+ i = 0;
50
43
  for (i; i < 24; i++) {
51
44
  hours.push({
52
45
  value: i,
53
46
  text: i
54
47
  });
55
48
  }
56
-
57
49
  return hours;
58
50
  };
59
-
60
51
  const getMinutes = () => {
61
52
  let minutes = [],
62
- i = 0;
63
-
53
+ i = 0;
64
54
  for (i; i < 60; i++) {
65
55
  minutes.push({
66
56
  value: i,
67
57
  text: i
68
58
  });
69
59
  }
70
-
71
60
  return minutes;
72
61
  };
73
-
74
62
  const checkValue = value => {
75
63
  if (!isNaN(Date.parse(value))) {
76
64
  return true;
77
65
  }
78
-
79
66
  return false;
80
67
  };
81
-
82
68
  const getValue = value => {
83
69
  if (typeof value === 'string') {
84
70
  const date = new Date();
@@ -87,14 +73,11 @@ const getValue = value => {
87
73
  date.setHours(...value);
88
74
  value = date;
89
75
  }
90
-
91
76
  if (checkValue(value)) {
92
77
  return new Date(value);
93
78
  }
94
-
95
79
  return new Date();
96
80
  };
97
-
98
81
  const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
99
82
  activeHeight,
100
83
  activeWidth,
@@ -124,15 +107,12 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
124
107
  main: 'DCUI-time-picker-main' + Id,
125
108
  label: 'DCUI-time-picker-label' + Id
126
109
  };
127
-
128
110
  if (!ref) {
129
111
  ref = useRef(null);
130
112
  }
131
-
132
113
  if (!inputRef) {
133
114
  inputRef = useRef(null);
134
115
  }
135
-
136
116
  const mainRef = useRef(null);
137
117
  const clockContainerRef = useRef(null);
138
118
  const swiperWrapperHoursRef = useRef(null);
@@ -459,13 +439,11 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
459
439
  `
460
440
  }
461
441
  };
462
-
463
442
  const updateValue = value => {
464
443
  const time = getValue(value);
465
444
  values = [addZero(time.getHours()), addZero(time.getMinutes()), addZero(time.getSeconds())];
466
445
  setInputValue(values);
467
446
  };
468
-
469
447
  const getDefaultValue = () => {
470
448
  if (value && checkValue(value)) {
471
449
  return new Date(value);
@@ -475,26 +453,21 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
475
453
  return null;
476
454
  }
477
455
  };
478
-
479
456
  const escKeyFunc = ev => {
480
457
  //call the useOnClickOutside when press esc key
481
458
  if (ev.keyCode === 27) {
482
- onBlur(); // eslint-disable-next-line no-undef
483
-
459
+ onBlur();
460
+ // eslint-disable-next-line no-undef
484
461
  inputContainerRef.current.childNodes[0].blur();
485
462
  }
486
463
  };
487
-
488
464
  const getScrollParent = element => {
489
465
  const style = getComputedStyle(element);
490
466
  let scrollParent = window;
491
-
492
467
  if (style.position !== 'fixed') {
493
468
  let parent = element.parentElement;
494
-
495
469
  while (parent) {
496
470
  const parentStyle = getComputedStyle(parent);
497
-
498
471
  if (/(auto|scroll)/.test(parentStyle.overflow + parentStyle.overflowY + parentStyle.overflowX)) {
499
472
  scrollParent = parent;
500
473
  parent = undefined;
@@ -503,24 +476,19 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
503
476
  }
504
477
  }
505
478
  }
506
-
507
479
  return scrollParent;
508
480
  };
509
-
510
481
  const setPositionClock = () => {
511
482
  const clock = clockContainerRef.current;
512
483
  const container = ref.current;
513
-
514
484
  if (!clock || !container) {
515
485
  return;
516
486
  }
517
-
518
487
  const {
519
488
  bottom,
520
489
  left,
521
490
  top
522
491
  } = container.getBoundingClientRect();
523
-
524
492
  if (top > window.innerHeight) {
525
493
  clock.style.top = 'auto';
526
494
  clock.style.bottom = '5px';
@@ -546,7 +514,6 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
546
514
  clock.style.transformOrigin = 'top left';
547
515
  }
548
516
  }
549
-
550
517
  if (left < 0) {
551
518
  clock.style.left = '5px';
552
519
  } else if (left + activeWidth > window.innerWidth) {
@@ -555,84 +522,71 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
555
522
  clock.style.left = left + 'px';
556
523
  }
557
524
  };
558
-
559
525
  const setInputValue = values => {
560
526
  if (!inputRef.current) return;
561
527
  const input = inputRef.current;
562
-
563
528
  if (allowSeconds) {
564
529
  input.value = values[0] + ':' + values[1] + ':' + values[2];
565
530
  } else {
566
531
  input.value = values[0] + ':' + values[1] + ':00';
567
532
  }
568
-
569
533
  if (onChange) onChange(input);
570
534
  };
571
-
572
535
  const onFocus = () => {
573
536
  document.body.style.overflow = 'hidden';
574
537
  mainRef.current.classList.add('focused');
575
538
  setPositionClock();
576
539
  };
577
-
578
540
  const onBlur = () => {
579
541
  mainRef.current.classList.remove('focused');
580
542
  inputRef.current.blur();
581
543
  document.body.style.overflow = null;
582
544
  };
583
-
584
545
  const onOpen = () => {
585
546
  inputRef.current.focus();
586
547
  };
587
-
588
548
  const onClose = () => onBlur();
549
+ useOnClickOutside(ref, onBlur);
589
550
 
590
- useOnClickOutside(ref, onBlur); // const validateValue = (text) => {
551
+ // const validateValue = (text) => {
591
552
  // const timeRegex = /^(0?[0-9]|1[0-9]|2[0-3])(:(0?[0-9]|[1-5][0-9]))?(:(0?[0-9]|[1-5][0-9]))$/;
592
553
  // if (timeRegex.test(text)) return true;
593
554
  // return false;
594
555
  // };
595
-
596
556
  const validateKeyboard = e => {
597
557
  if (!/[0-9:]/.test(e.key)) {
598
558
  e.preventDefault();
599
559
  }
600
560
  };
601
-
602
561
  const setInputHour = e => {
603
562
  if (!inputRef.current) return;
604
563
  values = inputRef.current.value.split(':');
605
564
  values.splice(0, 1, addZero(e.text));
606
565
  setInputValue(values);
607
566
  };
608
-
609
567
  const setInputMinute = e => {
610
568
  if (!inputRef.current) return;
611
569
  values = inputRef.current.value.split(':');
612
570
  values.splice(1, 1, addZero(e.text));
613
571
  setInputValue(values);
614
572
  };
615
-
616
573
  const setInputSecond = e => {
617
574
  if (!inputRef.current) return;
618
575
  values = inputRef.current.value.split(':');
619
576
  values.splice(2, 1, addZero(e.text));
620
577
  setInputValue(values);
621
578
  };
622
-
623
579
  useEffect(() => {
624
580
  const parent = ref.current;
625
581
  const scrollParent = getScrollParent(parent);
626
-
627
582
  if (defaultValue) {
628
583
  updateValue(defaultValue);
629
584
  } else {
630
585
  inputRef.current.value = '';
631
- } // if (value) {
586
+ }
587
+ // if (value) {
632
588
  // updateValue(value);
633
589
  // }
634
-
635
-
636
590
  window.addEventListener('resize', setPositionClock);
637
591
  document.addEventListener('keydown', e => escKeyFunc(e));
638
592
  scrollParent.addEventListener('scroll', setPositionClock);
@@ -657,7 +611,6 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
657
611
  ref.current.disabled = true;
658
612
  ref.current.classList.add('disabled');
659
613
  }
660
-
661
614
  return () => {
662
615
  if (ref.current) {
663
616
  ref.current.disabled = false;
@@ -669,7 +622,6 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
669
622
  if (error && error !== '') {
670
623
  mainRef.current.classList.add('error');
671
624
  }
672
-
673
625
  return () => {
674
626
  !!mainRef.current && mainRef.current.classList.remove('error');
675
627
  };
@@ -684,7 +636,8 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
684
636
  id: IDs.label,
685
637
  htmlFor: IDs.inputTypeText
686
638
  }, label), RequireMemo), [label, required, error, disabled]);
687
- const InputMemo = useMemo(() => jsx("input", { ...inputProps,
639
+ const InputMemo = useMemo(() => jsx("input", {
640
+ ...inputProps,
688
641
  css: styles.input[viewType],
689
642
  disabled: disabled,
690
643
  id: IDs.inputTypeText,
@@ -762,7 +715,8 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
762
715
  css: styles.main[viewType],
763
716
  ref: mainRef
764
717
  }, InputMemo, IconMemo, ErrorMemo), [activeHeight, activeWidth, allowSeconds, defaultValue, disabled, error, value, viewType]);
765
- return jsx("div", { ...props,
718
+ return jsx("div", {
719
+ ...props,
766
720
  css: styles.container[viewType],
767
721
  ref: ref
768
722
  }, LabelMemo, MainMemo, ClockMemo);
@@ -778,37 +732,26 @@ TimePicker.defaultProps = {
778
732
  TimePicker.propTypes = {
779
733
  /** height of the clock when display */
780
734
  activeHeight: PropTypes.number,
781
-
782
735
  /** width of the clock when display */
783
736
  activeWidth: PropTypes.number,
784
-
785
737
  /** allow second field on clock */
786
738
  allowSeconds: PropTypes.bool,
787
-
788
739
  /** the default value when the clock is open */
789
740
  defaultValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
790
-
791
741
  /** if 'true' the form control will be disabled */
792
742
  disabled: PropTypes.bool,
793
-
794
743
  /** error of the form control */
795
744
  error: PropTypes.string,
796
-
797
745
  /** label of the form control */
798
746
  label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
799
-
800
747
  /** properties of the input element */
801
748
  inputProps: PropTypes.object,
802
-
803
749
  /** a callback function when value input change */
804
750
  onChange: PropTypes.func,
805
-
806
751
  /** required state of the form control */
807
752
  required: PropTypes.bool,
808
-
809
753
  /** the default value when the clock is open */
810
754
  value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
811
-
812
755
  /** view type of the form control */
813
756
  viewType: PropTypes.oneOf(['outlined', 'underlined'])
814
757
  };