diginet-core-ui 1.3.24 → 1.3.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/assets/fonts/SF-Pro-Display-Bold.otf +0 -0
  2. package/assets/fonts/SF-Pro-Display-Medium.otf +0 -0
  3. package/assets/fonts/SF-Pro-Display-Regular.otf +0 -0
  4. package/assets/images/icons/wifi.svg +3 -0
  5. package/assets/images/menu/dhr/MHRM09N0004.svg +14 -0
  6. package/assets/images/menu/dhr/MHRP09N0028.svg +6 -0
  7. package/assets/images/menu/dhr/MHRP09N0029.svg +14 -0
  8. package/assets/images/menu/dhr/MHRP09N0030.svg +4 -0
  9. package/assets/images/menu/dhr/MHRP09N0031.svg +5 -0
  10. package/assets/images/menu/dhr/MHRP29N0012.svg +7 -0
  11. package/assets/images/menu/dhr/MHRP29N0021.svg +8 -0
  12. package/assets/images/menu/dhr/MHRP29N0022.svg +9 -0
  13. package/assets/images/menu/dhr/MHRP29N0023.svg +22 -0
  14. package/assets/images/menu/dhr/MHRP39N0015.svg +5 -0
  15. package/assets/images/menu/dhr/TASK.svg +9 -0
  16. package/assets/images/menu/erp/D05.svg +8 -0
  17. package/assets/images/menu/erp/D06.svg +4 -0
  18. package/assets/images/menu/erp/D90R.svg +9 -0
  19. package/assets/images/menu/erp/DBC.svg +9 -0
  20. package/assets/images/menu/erp/{W05F0006.svg → W05F0006N0000.svg} +0 -0
  21. package/assets/images/menu/erp/{W05F0008.svg → W05F0008N0000.svg} +0 -0
  22. package/assets/images/menu/erp/{W05F4000.svg → W05F4000N0000.svg} +0 -0
  23. package/assets/images/menu/erp/{W06F0005.svg → W06F0005N0000.svg} +0 -0
  24. package/assets/images/menu/erp/{W06F0006.svg → W06F0006N0000.svg} +0 -0
  25. package/assets/images/menu/erp/{W06F0008.svg → W06F0008N0000.svg} +0 -0
  26. package/assets/images/menu/erp/W94F1000N0000.svg +9 -0
  27. package/assets/images/menu/erp/W94F1000N0001.svg +9 -0
  28. package/components/accordion/css.js +42 -33
  29. package/components/accordion/details.js +29 -17
  30. package/components/accordion/group.js +23 -23
  31. package/components/accordion/index.js +36 -27
  32. package/components/accordion/summary.js +10 -11
  33. package/components/alert/index.js +97 -91
  34. package/components/alert/notify.js +10 -8
  35. package/components/avatar/index.js +19 -17
  36. package/components/badge/index.js +122 -139
  37. package/components/button/icon.js +242 -334
  38. package/components/button/index.js +272 -427
  39. package/components/button/more.js +4 -5
  40. package/components/button/ripple-effect.js +4 -6
  41. package/components/card/body-card.js +4 -6
  42. package/components/card/card.js +4 -8
  43. package/components/card/index.js +4 -5
  44. package/components/chart/Pie/Sector.js +4 -5
  45. package/components/chart/Pie/Sectors.js +5 -5
  46. package/components/chart/Pie/index.js +8 -9
  47. package/components/chart/Pie-v2/Sector.js +4 -5
  48. package/components/chart/Pie-v2/Sectors.js +7 -8
  49. package/components/chart/Pie-v2/index.js +11 -16
  50. package/components/chart/bar/Bar.js +2 -3
  51. package/components/chart/bar/Labels.js +9 -11
  52. package/components/chart/bar/index.js +17 -9
  53. package/components/chart/bar-v2/Bar.js +2 -3
  54. package/components/chart/bar-v2/Labels.js +9 -11
  55. package/components/chart/bar-v2/index.js +17 -9
  56. package/components/chart/line/Labels.js +8 -10
  57. package/components/chart/line/Point.js +2 -3
  58. package/components/chart/line/index.js +17 -9
  59. package/components/chart/line-v2/Labels.js +8 -10
  60. package/components/chart/line-v2/Point.js +2 -3
  61. package/components/chart/line-v2/index.js +17 -9
  62. package/components/chip/attach.js +12 -16
  63. package/components/chip/index.js +8 -11
  64. package/components/collapse/index.js +4 -5
  65. package/components/divider/index.js +27 -14
  66. package/components/form-control/attachment/index.js +143 -87
  67. package/components/form-control/calendar/function.js +24 -23
  68. package/components/form-control/calendar/index.js +2 -4
  69. package/components/form-control/calendar/range.js +3 -4
  70. package/components/form-control/checkbox/index.js +85 -71
  71. package/components/form-control/control/index.js +4 -6
  72. package/components/form-control/date-picker/index-old.js +0 -2
  73. package/components/form-control/date-picker/index.js +39 -43
  74. package/components/form-control/date-range-picker/index.js +26 -28
  75. package/components/form-control/dropdown/index.js +173 -202
  76. package/components/form-control/dropdown-box/index.js +72 -49
  77. package/components/form-control/form-group/index.js +4 -5
  78. package/components/form-control/helper-text/index.js +4 -5
  79. package/components/form-control/input-base/index.js +28 -38
  80. package/components/form-control/label/index.js +23 -13
  81. package/components/form-control/money-input/index.js +6 -6
  82. package/components/form-control/number-input/index.js +12 -14
  83. package/components/form-control/phone-input/index.js +4 -5
  84. package/components/form-control/radio/index.js +7 -15
  85. package/components/form-control/text-input/index.js +14 -24
  86. package/components/form-control/time-picker/index.js +15 -26
  87. package/components/form-control/time-picker/swiper.js +2 -4
  88. package/components/form-control/toggle/index.js +22 -18
  89. package/components/form-view/helper-text.js +4 -5
  90. package/components/form-view/index.js +4 -5
  91. package/components/form-view/input.js +5 -7
  92. package/components/form-view/label.js +2 -6
  93. package/components/list/list-item-action.js +7 -8
  94. package/components/list/list-item-icon.js +4 -5
  95. package/components/list/list-item-text.js +4 -5
  96. package/components/list/list-item.js +4 -5
  97. package/components/list/list.js +4 -5
  98. package/components/list/sub-header.js +4 -5
  99. package/components/modal/body.js +4 -6
  100. package/components/modal/footer.js +4 -6
  101. package/components/modal/header.js +8 -14
  102. package/components/modal/index.js +4 -5
  103. package/components/modal/modal.js +6 -13
  104. package/components/others/extra/index.js +4 -8
  105. package/components/others/option-wrapper/index.js +57 -0
  106. package/components/others/scrollbar/index.js +4 -5
  107. package/components/paging/page-info.js +282 -231
  108. package/components/paging/page-selector.js +4 -7
  109. package/components/popover/index.js +6 -7
  110. package/components/popup/danger_popup.js +8 -18
  111. package/components/popup/index.js +26 -34
  112. package/components/popup/proposals_popup.js +9 -16
  113. package/components/popup/v2/danger-popup.js +4 -6
  114. package/components/popup/v2/index.js +116 -98
  115. package/components/popup/v2/info-popup.js +4 -6
  116. package/components/popup/v2/success-popup.js +4 -6
  117. package/components/popup/v2/warning-popup.js +4 -6
  118. package/components/popup/v2/yes-no-popup.js +4 -6
  119. package/components/progress/circular.js +17 -26
  120. package/components/progress/linear.js +11 -13
  121. package/components/rating/index.js +114 -233
  122. package/components/slider/slider-container.js +15 -10
  123. package/components/slider/slider-item.js +10 -12
  124. package/components/status/index.js +63 -57
  125. package/components/tab/tab-container.js +26 -24
  126. package/components/tab/tab-header.js +36 -27
  127. package/components/tab/tab-panel.js +32 -15
  128. package/components/tab/tab.js +79 -80
  129. package/components/tooltip/index.js +4 -4
  130. package/components/transfer/index.js +10 -11
  131. package/components/tree-view/css.js +2 -0
  132. package/components/tree-view/index.js +14 -13
  133. package/components/typography/index.js +6 -112
  134. package/css/styles.css +1 -1
  135. package/css/styles.css.map +1 -1
  136. package/global/index.js +2 -0
  137. package/icons/basic.js +1648 -959
  138. package/icons/effect.js +45 -103
  139. package/package.json +1 -1
  140. package/readme.md +66 -0
  141. package/styles/color-helper.js +7 -146
  142. package/styles/colors.js +6 -2
  143. package/styles/font.js +9 -0
  144. package/styles/general.js +100 -7
  145. package/styles/typography.js +25 -26
  146. package/theme/settings.js +9 -2
  147. package/theme/theme-provider.js +15 -7
  148. package/theme/with-styles.js +2 -4
  149. package/theme/with-theme.js +2 -4
  150. package/utils/isMobile.js +21 -0
  151. package/utils/renderHTML.js +4 -5
  152. package/utils/renderIcon.js +15 -11
  153. package/utils/updatePosition.js +2 -2
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
@@ -10,6 +8,7 @@ import { getGlobal } from '../../../global';
10
8
  import locale from '../../../locale';
11
9
  import theme from '../../../theme/settings';
12
10
  import { date as moment } from '../../../utils';
11
+ import { typography } from "../../../styles/typography";
13
12
  /**
14
13
  * START STYLE
15
14
  */
@@ -117,14 +116,14 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
117
116
  &.${unique.day.active} {
118
117
  span.${unique.day.day} {
119
118
  background-color: ${theme.colors.focus};
120
- font-family: ${theme.typography.fontFamilyBold};
119
+ ${typography.heading5};
121
120
  }
122
121
  }
123
122
  &.${unique.day.today} {
124
123
  span {
125
124
  border : ${theme.border.style} 1px ${theme.colors.primary};
126
125
  box-sizing : border-box;
127
- font-weight : 700;
126
+ ${typography.heading5}
128
127
  /* text-decoration-line : underline;
129
128
  text-decoration-thickness: 2px;
130
129
  text-underline-offset : 1px */
@@ -293,12 +292,7 @@ const buttonTextProps = fn => {
293
292
 
294
293
 
295
294
  const isValidDate = value => {
296
- if (!!value && value !== null && !isNaN(Date.parse(new Date(value)))) {
297
- return true;
298
- }
299
-
300
- ;
301
- return false;
295
+ return new Date(value) instanceof Date && !isNaN(new Date(value));
302
296
  };
303
297
  /**
304
298
  *
@@ -431,7 +425,8 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
431
425
  /*(displayAnotherMonth ? 0 : 1)*/
432
426
  ,
433
427
  className: `${[className.table.data, 'previous_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isBetween(day, active[0], active[1], className.day)].join(' ')}`
434
- }, jsx(Typography, typographyProps(className.day.day), '')));
428
+ }, jsx(Typography, { ...typographyProps(className.day.day)
429
+ }, '')));
435
430
  }
436
431
  /**
437
432
  * days of this month
@@ -445,7 +440,8 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
445
440
  "data-time": Date.parse(day),
446
441
  className: `${[className.table.data, 'this_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit), isBetween(day, active[0], active[1], className.day)].join(' ')}`,
447
442
  onClick: onTableDataClick
448
- }, jsx(Typography, typographyProps(className.day.day), i + 1)));
443
+ }, jsx(Typography, { ...typographyProps(className.day.day)
444
+ }, i + 1)));
449
445
  }
450
446
  /**
451
447
  * days of next month
@@ -461,7 +457,8 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
461
457
  /*(displayAnotherMonth ? 0 : 1)*/
462
458
  ,
463
459
  className: `${[className.table.data, 'next_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isBetween(day, active[0], active[1], className.day)].join(' ')}`
464
- }, jsx(Typography, typographyProps(className.day.day), '')));
460
+ }, jsx(Typography, { ...typographyProps(className.day.day)
461
+ }, '')));
465
462
  }
466
463
  } else {
467
464
  /**
@@ -473,7 +470,8 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
473
470
  key: `previous_month-${prevDate - i + 1}`,
474
471
  "data-time": Date.parse(day) - (displayAnotherMonth ? 0 : 1),
475
472
  className: `${[className.table.data, 'previous_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active)].join(' ')}`
476
- }, jsx(Typography, typographyProps(className.day.day), displayAnotherMonth ? prevDate - i + 1 : '')));
473
+ }, jsx(Typography, { ...typographyProps(className.day.day)
474
+ }, displayAnotherMonth ? prevDate - i + 1 : '')));
477
475
  }
478
476
  /**
479
477
  * days of this month
@@ -487,7 +485,8 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
487
485
  "data-time": Date.parse(day),
488
486
  className: `${[className.table.data, 'this_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit)].join(' ')}`,
489
487
  onClick: onTableDataClick
490
- }, jsx(Typography, typographyProps(className.day.day), i + 1)));
488
+ }, jsx(Typography, { ...typographyProps(className.day.day)
489
+ }, i + 1)));
491
490
  }
492
491
  /**
493
492
  * days of next month
@@ -500,7 +499,8 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
500
499
  key: `next_month-${i + 1}`,
501
500
  "data-time": Date.parse(day) + (displayAnotherMonth ? 0 : 1),
502
501
  className: `${[className.table.data, 'next_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active)].join(' ')}`
503
- }, jsx(Typography, typographyProps(className.day.day), displayAnotherMonth ? i + 1 : '')));
502
+ }, jsx(Typography, { ...typographyProps(className.day.day)
503
+ }, displayAnotherMonth ? i + 1 : '')));
504
504
  }
505
505
  }
506
506
 
@@ -560,31 +560,32 @@ const renderNavigator = (className, refs, dbLeftFn, leftFn, rightFn, dbRightFn,
560
560
  className: className.navigator.navigator
561
561
  }, jsx("div", {
562
562
  className: className.navigator.around
563
- }, jsx(ButtonIcon, _extends({}, buttonIconProps(className.icon), {
563
+ }, jsx(ButtonIcon, { ...buttonIconProps(className.icon),
564
564
  name: 'ArrowDoubleLeft',
565
565
  onClick: dbLeftFn,
566
566
  ref: refs.doubleLeft
567
- })), jsx(ButtonIcon, _extends({}, buttonIconProps(className.icon), {
567
+ }), jsx(ButtonIcon, { ...buttonIconProps(className.icon),
568
568
  name: 'ArrowLeft',
569
569
  onClick: leftFn,
570
570
  ref: refs.left
571
- }))), jsx("div", {
571
+ })), jsx("div", {
572
572
  className: className.navigator.center
573
- }, jsx(Button, buttonTextProps(fn), jsx(Typography, {
573
+ }, jsx(Button, { ...buttonTextProps(fn)
574
+ }, jsx(Typography, {
574
575
  color: 'primary',
575
576
  type: 'h3',
576
577
  ref: refs.content
577
578
  }))), jsx("div", {
578
579
  className: className.navigator.around
579
- }, jsx(ButtonIcon, _extends({}, buttonIconProps(className.icon), {
580
+ }, jsx(ButtonIcon, { ...buttonIconProps(className.icon),
580
581
  name: 'ArrowRight',
581
582
  onClick: rightFn,
582
583
  ref: refs.right
583
- })), jsx(ButtonIcon, _extends({}, buttonIconProps(className.icon), {
584
+ }), jsx(ButtonIcon, { ...buttonIconProps(className.icon),
584
585
  name: 'ArrowDoubleRight',
585
586
  onClick: dbRightFn,
586
587
  ref: refs.doubleRight
587
- }))));
588
+ })));
588
589
  /**
589
590
  *
590
591
  * @param {Date} time
@@ -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 */
@@ -209,11 +207,11 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
209
207
  * END COMPONENT
210
208
  */
211
209
 
212
- return jsx("div", _extends({}, props, {
210
+ return jsx("div", { ...props,
213
211
  className: [unique.container, className].join(' '),
214
212
  css: generateCalendarCSS(unique),
215
213
  ref: ref
216
- }), renderNavigator(unique, navigatorRefs, setPrevYear, setPrevMonth, setNextMonth, setNextYear), tableMemo, actions);
214
+ }, renderNavigator(unique, navigatorRefs, setPrevYear, setPrevMonth, setNextMonth, setNextYear), tableMemo, actions);
217
215
  }));
218
216
  Calendar.defaultProps = {
219
217
  actions: null,
@@ -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 */
@@ -256,12 +254,13 @@ const CalendarRange = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
256
254
  onUpdate(defaultValue);
257
255
  }
258
256
  }, []);
259
- return jsx("div", _extends({}, props, {
257
+ return jsx("div", { ...props,
260
258
  className: unique.container,
261
259
  onMouseOver: onPickerHover,
262
260
  css: containerCSS,
263
261
  ref: ref
264
- }), calendarFrom, jsx(Divider, dividerProps), calendarTo, actions);
262
+ }, calendarFrom, jsx(Divider, { ...dividerProps
263
+ }), calendarTo, actions);
265
264
  }));
266
265
  CalendarRange.defaultProps = {
267
266
  actions: null,
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
@@ -7,15 +5,20 @@ import { css, jsx } from '@emotion/core';
7
5
  import PropTypes from 'prop-types';
8
6
  import { forwardRef, memo, useEffect, useRef, useState, useImperativeHandle } from 'react';
9
7
  import { Typography } from '../..';
10
- import theme from '../../../theme/settings';
8
+ import { alignCenter, alignStart, borderBox, cursorPointer, displayBlock, flexRow, pointerEventsNone, positionAbsolute, positionRelative, userSelectNone } from '../../../styles/general';
11
9
  import { randomString } from '../../../utils';
12
- const colors = {
13
- primary: theme.colors.primary,
14
- info: theme.colors.info,
15
- success: theme.colors.success,
16
- warning: theme.colors.warning,
17
- danger: theme.colors.danger
18
- };
10
+ import { color as colors } from '../../../styles/colors';
11
+ const {
12
+ system: {
13
+ disabled: systemDisabled,
14
+ rest,
15
+ white
16
+ },
17
+ fill: {
18
+ hover,
19
+ focusshd
20
+ }
21
+ } = colors;
19
22
  const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
20
23
  id,
21
24
  className,
@@ -39,6 +42,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
39
42
  }
40
43
 
41
44
  const ref = useRef(null);
45
+ const [checkedState, setCheckedState] = useState(checked || defaultChecked);
42
46
 
43
47
  if (!id) {
44
48
  [id] = useState('DGN-UI-' + randomString(10, {
@@ -55,8 +59,8 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
55
59
  &::after {
56
60
  transform: translate(-50%, -66%) scale(1) rotate(-45deg);
57
61
  background:
58
- linear-gradient(${theme.colors.white}, ${theme.colors.white}) left bottom/2px 100%,
59
- linear-gradient(${theme.colors.white}, ${theme.colors.white}) left bottom/100% 2px;
62
+ linear-gradient(${white}, ${white}) left bottom/2px 100%,
63
+ linear-gradient(${white}, ${white}) left bottom/100% 2px;
60
64
  background-repeat: no-repeat;
61
65
  }
62
66
  }
@@ -68,21 +72,23 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
68
72
  }
69
73
  `;
70
74
  const CheckBoxSquare = css`
71
- display: flex;
72
- position: relative;
75
+ ${flexRow}
76
+ ${positionRelative}
77
+ ${borderBox}
73
78
  width: 18px;
79
+ min-width: 18px;
74
80
  height: 18px;
75
- background-color: ${theme.colors.white};
76
- border: 2px solid ${theme.colors.border};
77
- box-sizing: border-box;
81
+ min-height: 18px;
82
+ background-color: ${white};
83
+ border: 2px solid ${rest};
78
84
  border-radius: 2px;
79
85
  &.determinate {
80
86
  &::after {
87
+ ${displayBlock}
88
+ ${positionAbsolute}
81
89
  content : '';
82
- display : block;
83
90
  height : 7px;
84
91
  left : 50%;
85
- position : absolute;
86
92
  top : 43%;
87
93
  transform : translate(-50%, -50%) scale(0) rotate(45deg);
88
94
  transition: transform 0.3s;
@@ -91,9 +97,9 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
91
97
  }
92
98
  &.indeterminate {
93
99
  &::after {
100
+ ${flexRow}
101
+ ${positionAbsolute}
94
102
  content: "";
95
- display: flex;
96
- position: absolute;
97
103
  background-color: white;
98
104
  left: 2px;
99
105
  top: 6px;
@@ -105,55 +111,55 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
105
111
  }
106
112
  &:hover {
107
113
  box-shadow:
108
- 0 0 2px 2px ${theme.colors.focus};
109
- background-color:${theme.colors.focus};
114
+ 0 0 2px 2px ${focusshd};
115
+ background-color:${focusshd};
110
116
  }
111
117
 
112
118
  `;
113
119
  const CheckBoxLabel = css`
114
- display: flex;
115
- position: relative;
116
- align-items: center;
120
+ ${flexRow}
121
+ ${positionRelative}
122
+ ${alignCenter}
123
+ ${borderBox}
117
124
  padding-left: 8px;
118
- box-sizing: border-box;
119
125
  `;
120
126
  const CheckBoxRoot = css`
121
- display: flex;
122
- position: relative;
123
- align-items: center;
127
+ ${flexRow}
128
+ ${positionRelative}
129
+ ${alignStart}
130
+ ${cursorPointer}
131
+ ${userSelectNone}
132
+ ${borderBox}
124
133
  margin: 3px 0;
125
- cursor: pointer;
126
- user-select: none;
127
- box-sizing: border-box;
128
134
  &.disabled {
129
- pointer-events: none;
135
+ ${pointerEventsNone}
130
136
  .css-${CheckBoxSquare.name} {
131
- border-color:${theme.colors.disabled};
137
+ border-color:${systemDisabled};
132
138
  }
133
139
  .css-${CheckBoxInput.name} {
134
140
  &:checked {
135
141
  &.determinate + span::after {
136
142
  background:
137
- linear-gradient(${theme.colors.white},${theme.colors.white}) left bottom/2px 100%,
138
- linear-gradient(${theme.colors.white},${theme.colors.white}) left bottom/ 100% 2px;
143
+ linear-gradient(${white},${white}) left bottom/2px 100%,
144
+ linear-gradient(${white},${white}) left bottom/ 100% 2px;
139
145
  background-repeat: no-repeat;
140
146
  }
141
147
  &.indeterminate + span::after {
142
- background-color: ${theme.colors.white};
148
+ background-color: ${white};
143
149
  }
144
150
  & + span {
145
- background-color:${theme.colors.disabled};
151
+ background-color:${systemDisabled};
146
152
  }
147
153
  }
148
154
  }
149
155
  }
150
156
  &.read-only {
151
- pointer-events: none;
152
- user-select: none;
157
+ ${pointerEventsNone}
158
+ ${userSelectNone}
153
159
  }
154
160
  &:not(.disabled):hover {
155
161
  .css-${CheckBoxSquare.name} {
156
- background-color:${theme.colors.hover};
162
+ background-color:${hover};
157
163
  border-color:${colors[color] || color};
158
164
  }
159
165
  .css-${CheckBoxInput.name} {
@@ -172,8 +178,8 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
172
178
  }
173
179
  `;
174
180
  const CheckboxContainer = css`
175
- display: block;
176
- position: relative;
181
+ ${displayBlock}
182
+ ${positionRelative}
177
183
  width: max-content;
178
184
  &.disabled {
179
185
  cursor: no-drop;
@@ -182,10 +188,9 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
182
188
 
183
189
  const handleChange = () => {
184
190
  if (readOnly || inputProps.readOnly || disabled || inputProps.disabled) return;
185
- const checked = !inputRef.current.checked;
186
- inputRef.current.checked = checked;
191
+ setChecked(checked !== undefined ? checked : !checkedState);
187
192
  const e = {
188
- value: checked,
193
+ value: !checkedState,
189
194
  target: inputRef.current
190
195
  };
191
196
  if (onChange) onChange(e, checked);
@@ -193,35 +198,45 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
193
198
 
194
199
  const setChecked = check => {
195
200
  if (typeof check === 'boolean') {
196
- inputRef.current.checked = check;
201
+ setCheckedState(check);
197
202
  }
198
203
  };
199
204
 
200
205
  useEffect(() => {
201
- setChecked(checked);
206
+ if (checked !== undefined) setChecked(checked);
202
207
  }, [checked]);
203
208
  useImperativeHandle(reference, () => {
204
- ref.current.determinate = determinate;
205
- ref.current.setChecked = setChecked;
209
+ const currentRef = ref.current || {};
210
+ const _instance = {
211
+ determinate: determinate,
212
+ setChecked: setChecked,
213
+ getChecked: () => inputRef.current.checked
214
+ }; // methods
215
+
216
+ _instance.__proto__ = {}; // hidden methods
217
+
218
+ currentRef.instance = _instance;
219
+ currentRef.determinate = determinate;
220
+ currentRef.setChecked = setChecked;
206
221
 
207
- ref.current.getChecked = () => inputRef.current.checked;
222
+ currentRef.getChecked = () => inputRef.current.checked;
208
223
 
209
- return ref.current;
224
+ return currentRef;
210
225
  });
211
- return jsx("div", _extends({
226
+ return jsx("div", {
212
227
  id: 'DGN-UI-Checkbox-' + id.replace('DGN-UI-', ''),
213
228
  css: CheckboxContainer,
214
- className: ['DGN-UI-Checkbox', disabled ? 'disabled' : '', className].join(' ').trim(),
215
- ref: ref
216
- }, props, {
229
+ className: ['DGN-UI-Checkbox', disabled ? 'disabled' : '', className].join(' ').trim().replace(/\s+/g, ' '),
230
+ ref: ref,
231
+ ...props,
217
232
  onClick: handleChange
218
- }), jsx("div", {
233
+ }, jsx("div", {
219
234
  css: CheckBoxRoot,
220
235
  className: disabled ? 'disabled' : readOnly ? 'read-only' : ''
221
- }, jsx("input", _extends({
222
- value: value
223
- }, inputProps, {
224
- className: [determinate ? 'determinate' : 'indeterminate', inputProps.className || ''].join(' ').trim(),
236
+ }, jsx("input", {
237
+ value: value,
238
+ ...inputProps,
239
+ className: [determinate ? 'determinate' : 'indeterminate', inputProps.className || ''].join(' ').trim().replace(/\s+/g, ' '),
225
240
  readOnly: readOnly || inputProps.readOnly,
226
241
  disabled: disabled || inputProps.disabled,
227
242
  ref: inputRef,
@@ -229,9 +244,10 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
229
244
  id: id,
230
245
  name: name,
231
246
  type: "checkbox",
232
- defaultChecked: checked || defaultChecked,
247
+ checked: checkedState,
248
+ onChange: handleChange,
233
249
  hidden: true
234
- })), jsx("span", {
250
+ }), jsx("span", {
235
251
  css: CheckBoxSquare,
236
252
  className: determinate ? 'determinate' : 'indeterminate'
237
253
  }), (children || label) && jsx("div", {
@@ -294,13 +310,11 @@ Checkbox.propTypes = {
294
310
  onChange: PropTypes.func,
295
311
 
296
312
  /**
297
- * named ref: get ref of Checkbox component, insist:<br />
298
- * * element<br />
299
- * * setChecked: the method to set checked for input<br />
300
- * * getChecked: the method to get checked of input<br />
313
+ * ref methods
314
+ *
315
+ * * setChecked: Set check for input
316
+ * * getChecked: Get check of input
301
317
  */
302
- reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
303
- current: PropTypes.instanceOf(PropTypes.elementType)
304
- })])
318
+ ref: PropTypes.any
305
319
  };
306
320
  export default Checkbox;
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
@@ -7,8 +5,8 @@ import { css, jsx } from '@emotion/core';
7
5
  import PropTypes from 'prop-types';
8
6
  import { Children, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react';
9
7
  import theme from '../../../theme/settings';
8
+ import { typography } from "../../../styles/typography";
10
9
  const {
11
- typography,
12
10
  colors
13
11
  } = theme;
14
12
  const Control = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
@@ -26,7 +24,7 @@ const Control = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
26
24
  error: 'DGN-UI-Control-error'
27
25
  };
28
26
  const controlRootCSS = css`
29
- font-family : ${typography.fontFamily};
27
+ ${typography.paragraph3};
30
28
  margin-bottom: 20px;
31
29
  position : relative;
32
30
  &.${classes.disabled} {
@@ -61,12 +59,12 @@ const Control = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
61
59
  }
62
60
  };
63
61
  }, [disabled, error]);
64
- return jsx("div", _extends({}, props, {
62
+ return jsx("div", { ...props,
65
63
  className: ['DGN-UI-Control', className].join(' '),
66
64
  css: controlRootCSS,
67
65
  style: style,
68
66
  ref: ref
69
- }), children);
67
+ }, children);
70
68
  }));
71
69
  Control.defaultProps = {
72
70
  className: '',
@@ -6,7 +6,6 @@
6
6
  // import { Calendar as CalendarIcon, Cancel as CancelIcon } from '../../../icons';
7
7
  // import { randomString, useOnClickOutside } from '../../../utils';
8
8
  // import { blue4, blue13, brand, danger5, danger8, dark, dark4, dark6, dark8, info5, info8, success5, white } from '../../../styles/colors';
9
- // import { fontFamily } from '../../../styles/typography';
10
9
  // // import CalendarNavigator from './calendar-navigator'
11
10
  // const getElById = (id) => {
12
11
  // return document.getElementById(id);
@@ -74,7 +73,6 @@
74
73
  // container: css`
75
74
  // * {
76
75
  // box-sizing: border-box;
77
- // font-family: ${fontFamily};
78
76
  // }
79
77
  // border-radius: 4px;
80
78
  // box-sizing: border-box;