diginet-core-ui 1.4.14 → 1.4.15-beta.1

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 (131) hide show
  1. package/assets/images/menu/dhr/MHRM15N0001.svg +18 -0
  2. package/components/accordion/details.js +36 -25
  3. package/components/accordion/group.js +33 -18
  4. package/components/accordion/index.js +42 -28
  5. package/components/accordion/summary.js +60 -52
  6. package/components/alert/index.js +84 -75
  7. package/components/alert/notify.js +43 -31
  8. package/components/avatar/index.js +78 -75
  9. package/components/badge/index.js +62 -60
  10. package/components/breadcrumb/index.js +62 -44
  11. package/components/button/icon.js +69 -49
  12. package/components/button/index.js +97 -75
  13. package/components/button/more.js +60 -39
  14. package/components/button/ripple-effect.js +1 -1
  15. package/components/card/body.js +25 -15
  16. package/components/card/extra.js +25 -15
  17. package/components/card/footer.js +25 -15
  18. package/components/card/header.js +26 -15
  19. package/components/card/index.js +66 -57
  20. package/components/chart/bar/Labels.js +14 -8
  21. package/components/chart/bar-v2/Labels.js +14 -8
  22. package/components/chart/line/Labels.js +14 -8
  23. package/components/chart/line/Path.js +3 -3
  24. package/components/chart/line/Point.js +12 -11
  25. package/components/chart/line-v2/Labels.js +14 -8
  26. package/components/check-text/index.js +21 -16
  27. package/components/check-text/interview-confirmation.js +21 -15
  28. package/components/check-text/interview-status.js +21 -15
  29. package/components/chip/attach.js +6 -2
  30. package/components/chip/index.js +83 -82
  31. package/components/collapse/index.js +1 -1
  32. package/components/dialogs/colors.js +13 -11
  33. package/components/divider/index.js +40 -22
  34. package/components/form-control/attachment/index.js +252 -226
  35. package/components/form-control/calendar/function.js +42 -38
  36. package/components/form-control/calendar/index.js +32 -20
  37. package/components/form-control/calendar/range.js +38 -22
  38. package/components/form-control/checkbox/index.js +83 -59
  39. package/components/form-control/control/index.js +9 -10
  40. package/components/form-control/date-picker/index.js +81 -64
  41. package/components/form-control/date-range-picker/index.js +92 -75
  42. package/components/form-control/dropdown/index.js +200 -173
  43. package/components/form-control/dropdown-box/index.js +146 -187
  44. package/components/form-control/form-group/index.js +7 -6
  45. package/components/form-control/helper-text/index.js +45 -41
  46. package/components/form-control/input-base/index.js +165 -133
  47. package/components/form-control/label/index.js +48 -41
  48. package/components/form-control/money-input/index.js +76 -68
  49. package/components/form-control/number-input/index.js +579 -521
  50. package/components/form-control/number-input/index2.js +97 -70
  51. package/components/form-control/password-input/index.js +67 -59
  52. package/components/form-control/radio/index.js +85 -69
  53. package/components/form-control/text-input/index.js +79 -70
  54. package/components/form-control/time-picker/index.js +79 -56
  55. package/components/form-control/time-picker/v2/index.js +776 -0
  56. package/components/form-control/toggle/index.js +140 -129
  57. package/components/form-view/helper-text.js +2 -2
  58. package/components/form-view/index.js +34 -31
  59. package/components/form-view/input.js +70 -69
  60. package/components/form-view/label.js +14 -9
  61. package/components/grid/Col.js +48 -39
  62. package/components/grid/Container.js +31 -38
  63. package/components/grid/Row.js +28 -32
  64. package/components/grid/index.js +66 -54
  65. package/components/image/index.js +37 -27
  66. package/components/index.js +1 -1
  67. package/components/list/list-item-action.js +36 -26
  68. package/components/list/list-item-icon.js +34 -29
  69. package/components/list/list-item-text.js +27 -22
  70. package/components/list/list-item.js +42 -36
  71. package/components/list/list.js +46 -38
  72. package/components/list/sub-header.js +33 -26
  73. package/components/modal/body.js +24 -14
  74. package/components/modal/footer.js +23 -13
  75. package/components/modal/header.js +39 -28
  76. package/components/modal/index.js +3 -3
  77. package/components/modal/modal.js +60 -49
  78. package/components/others/extra/index.js +31 -30
  79. package/components/others/import/index.js +2 -2
  80. package/components/others/scrollbar/index.js +32 -26
  81. package/components/paging/page-info.js +33 -34
  82. package/components/paging/page-selector.js +15 -15
  83. package/components/paper/index.js +32 -28
  84. package/components/popover/body.js +14 -8
  85. package/components/popover/footer.js +13 -8
  86. package/components/popover/header.js +17 -15
  87. package/components/popover/index.js +71 -60
  88. package/components/popup/danger_popup.js +17 -16
  89. package/components/popup/index.js +16 -17
  90. package/components/popup/v2/index.js +28 -41
  91. package/components/progress/circular.js +65 -80
  92. package/components/progress/linear.js +73 -58
  93. package/components/rating/index.js +41 -55
  94. package/components/slider/slider-container.js +49 -57
  95. package/components/slider/slider-item.js +30 -29
  96. package/components/status/index.js +23 -34
  97. package/components/tab/tab-header.js +20 -11
  98. package/components/tab/tab-panel.js +12 -7
  99. package/components/tab/tab.js +35 -22
  100. package/components/tooltip/index.js +24 -35
  101. package/components/transfer/index.js +102 -103
  102. package/components/tree-view/index.js +99 -81
  103. package/components/typography/index.js +62 -45
  104. package/global/index.js +6 -17
  105. package/icons/basic.js +975 -972
  106. package/icons/effect.js +8 -7
  107. package/package.json +64 -31
  108. package/readme.md +7 -0
  109. package/styles/color-helper.js +2 -2
  110. package/styles/colors.js +168 -30
  111. package/styles/general.js +73 -5
  112. package/styles/sx/index.js +7 -4
  113. package/styles/utils.js +6 -5
  114. package/theme/createSpacing.js +10 -0
  115. package/theme/createTheme.js +26 -0
  116. package/theme/createZIndex.js +9 -0
  117. package/theme/index.js +13 -2
  118. package/theme/make-styles.js +2 -1
  119. package/theme/settings.js +699 -8
  120. package/theme/theme-provider.js +32 -15
  121. package/theme/theme.js +57 -56
  122. package/theme/use-classes.js +15 -0
  123. package/theme/utils/getThemeProps.js +12 -0
  124. package/theme/utils/resolveProps.js +17 -0
  125. package/theme/utils/useThemeProps.js +14 -0
  126. package/utils/handleBreakpoints.js +2 -2
  127. package/utils/hexToRGBA/index.js +2 -2
  128. package/utils/object/deepmerge.js +104 -0
  129. package/utils/object/object.js +7 -12
  130. package/utils/render-portal.js +4 -3
  131. package/theme/set-theme.js +0 -38
@@ -0,0 +1,18 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_1538_58)">
3
+ <path d="M38.9627 16.8C39.0626 16.1 38.7629 15.3 38.0636 14.7L35.9656 12.9V15.5L36.7648 16.2C36.8647 16.3 36.9646 16.4 36.9646 16.5C36.9646 16.6 36.9646 16.6 36.8647 16.7L36.7648 16.8L35.9656 17.5L33.9675 19.2L26.2749 25.7L24.6765 27L20.2807 30.7C20.0809 30.9 19.7812 31 19.4814 31C19.1817 31 18.882 30.9 18.6822 30.7L14.2864 27L12.7879 25.7L4.99537 19.2L2.9973 17.5L2.19806 16.8L2.09816 16.7C1.99826 16.6 1.99826 16.6 1.99826 16.5C1.99826 16.4 2.09816 16.3 2.19806 16.2L2.9973 15.5V12.9L0.899313 14.7C0.199985 15.3 -0.0997266 16 0.000177302 16.8C0.000177302 16.9 0.000177302 17 0.000177302 17V36C0.000177302 36.3 0.000177306 36.6 0.100081 36.8C0.499697 38.1 1.59864 39 2.9973 39H35.9656C37.3643 39 38.4632 38.1 38.8628 36.8C38.9627 36.6 38.9627 36.3 38.9627 36V17C38.9627 16.9 38.9627 16.8 38.9627 16.8ZM1.99826 19.2L2.9973 20L4.99537 21.7L11.1894 26.9L4.99537 32.2L2.9973 33.9L1.99826 34.7V19.2ZM35.9656 37H2.9973C2.89739 37 2.69758 37 2.59768 36.9L2.9973 36.5L4.99537 34.8L12.688 28.3L17.0838 32L17.3835 32.3C17.9829 32.8 18.7821 33 19.4814 33C20.2807 33 20.98 32.7 21.5794 32.3L21.8791 32L26.2749 28.3L33.9675 34.8L35.9656 36.5L36.3652 36.9C36.2653 37 36.1654 37 35.9656 37ZM36.9646 34.8L35.9656 34L33.9675 32.3L27.7735 27L33.9675 21.8L35.9656 20.1L36.9646 19.3V34.8Z" fill="#2680EB"/>
4
+ <path d="M25.4757 4H22.3787L21.1798 2.9L20.3806 2.2C20.0809 2.1 19.7812 2 19.4814 2C19.1817 2 18.882 2.1 18.6822 2.3L17.883 3L16.5842 4H13.4872L14.6861 2.9L17.2836 0.7C17.9829 0.3 18.6822 0 19.4814 0C20.2807 0 20.98 0.3 21.5794 0.7L25.4757 4Z" fill="#2680EB"/>
5
+ <path d="M31.9694 5H6.99345C5.29509 5 3.99634 6.4 3.99634 8V16.3L5.99441 18V8C5.99441 7.5 6.49393 7 6.99345 7H31.9694C32.469 7 32.9685 7.5 32.9685 8V18L34.9666 16.3V8C34.9666 6.4 33.6678 5 31.9694 5Z" fill="#2680EB"/>
6
+ <path d="M30.9701 19.1C30.8702 19.6 30.5705 19.9 30.1709 20.2C29.4715 20.7 28.6723 21.1 27.8731 21.3C27.0738 21.6 26.2746 21.4 25.4754 21.1C25.2756 21 25.1757 20.8 25.0758 20.6C24.9759 19.9 24.7761 19.1 24.6761 18.4C24.5762 17.9 24.2765 17.5 23.8769 17.2C23.8769 17.2 23.777 17.2 23.777 17.1C23.3774 16.9 23.3774 16.7 23.4773 16.3C23.5772 15.9 23.9768 15.6 24.3764 15.6C26.0748 15.6 27.8731 15.6 29.5714 15.6C30.071 15.6 30.3707 15.9 30.4706 16.4C30.5705 17.2 30.7703 17.9 30.8702 18.7V18.8C30.9701 18.8 30.9701 18.9 30.9701 19.1Z" fill="#FFAA00"/>
7
+ <path d="M26.9739 14.5C25.3755 14.5 24.0767 13.2 24.0767 11.6C24.0767 9.99995 25.3755 8.69995 26.9739 8.69995C28.5724 8.69995 29.8712 9.99995 29.8712 11.6C29.8712 13.2 28.5724 14.5 26.9739 14.5Z" fill="#FFAA00"/>
8
+ <path d="M7.99219 19.1C8.09209 19.6 8.3918 19.9 8.79142 20.2C9.49075 20.7 10.29 21.1 11.0892 21.3C11.8884 21.6 12.6877 21.4 13.4869 21.1C13.6867 21 13.7866 20.8 13.8865 20.6C13.9864 19.9 14.1862 19.1 14.2861 18.4C14.386 17.9 14.6858 17.5 15.0854 17.2C15.0854 17.2 15.1853 17.2 15.1853 17.1C15.5849 16.9 15.5849 16.7 15.485 16.3C15.3851 15.9 14.9855 15.6 14.5858 15.6C12.8875 15.6 11.0892 15.6 9.39084 15.6C8.89132 15.6 8.59161 15.9 8.49171 16.4C8.3918 17.2 8.192 17.9 8.09209 18.7V18.8C7.99219 18.8 7.99219 18.9 7.99219 19.1Z" fill="#FFAA00"/>
9
+ <path d="M11.9883 14.5C13.5868 14.5 14.8856 13.2 14.8856 11.6C14.8856 9.99995 13.5868 8.69995 11.9883 8.69995C10.3899 8.69995 9.09113 9.99995 9.09113 11.6C9.09113 13.2 10.3899 14.5 11.9883 14.5Z" fill="#FFAA00"/>
10
+ <path d="M19.4813 15.8999C17.5831 15.8999 16.0846 14.2999 16.0846 12.3999C16.0846 10.4999 17.683 8.8999 19.5812 8.8999C21.4794 8.8999 22.9779 10.4999 22.9779 12.3999C22.878 14.3999 21.3795 15.8999 19.4813 15.8999Z" fill="#FF8C00"/>
11
+ <path d="M24.0769 19.9999L23.8771 18.9999C23.7772 18.3999 22.878 17.7999 22.878 17.7999C22.878 17.7999 21.6792 17.0999 21.1797 16.9999C20.6801 16.8999 18.4823 16.8999 18.0826 16.9999C17.683 17.0999 16.3843 17.7999 16.3843 17.7999C16.3843 17.7999 15.585 18.2999 15.4851 18.6999L15.2853 19.6999C15.1854 19.9999 15.1854 20.2999 15.0855 20.5999C14.9856 21.0999 15.1854 21.5999 15.585 21.8999C16.3843 22.4999 17.1835 22.9999 18.1825 23.3999C18.9818 23.6999 19.8809 23.8999 20.78 23.5999C21.9789 23.1999 23.0778 22.5999 23.977 21.8999C24.3766 21.5999 24.5764 21.0999 24.4765 20.5999C24.0769 20.3999 24.0769 20.1999 24.0769 19.9999Z" fill="#FF8C00"/>
12
+ </g>
13
+ <defs>
14
+ <clipPath id="clip0_1538_58">
15
+ <rect width="39" height="39" fill="white"/>
16
+ </clipPath>
17
+ </defs>
18
+ </svg>
@@ -3,23 +3,28 @@
3
3
  import { css, jsx } from '@emotion/core';
4
4
  import PropTypes from 'prop-types';
5
5
  import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
6
- import { boxBorder, overflowHidden, parseHeight, pd, pointerEventsNone, positionRelative, textColor, userSelectNone } from "../../styles/general";
6
+ import { boxBorder, overflowHidden, parseHeight, pointerEventsNone, positionRelative, textColor, userSelectNone } from "../../styles/general";
7
7
  import { useTheme } from "../../theme";
8
- import { classNames } from "../../utils";
9
- const {
10
- typography: {
11
- paragraph1
12
- }
13
- } = useTheme();
14
- const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
15
- action = {},
16
- children,
17
- className,
18
- id,
19
- style
20
- }, reference) => {
8
+ import useThemeProps from "../../theme/utils/useThemeProps";
9
+ import { classNames, getProp } from "../../utils";
10
+ const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
21
11
  if (!reference) reference = useRef(null);
12
+ const theme = useTheme();
13
+
14
+ // props priority: `inProps` > `themeDefaultProps`
15
+ const props = useThemeProps({
16
+ props: inProps,
17
+ name: 'AccordionDetails'
18
+ });
19
+ const {
20
+ action = {},
21
+ children,
22
+ className,
23
+ id,
24
+ style
25
+ } = props;
22
26
  const ref = useRef(null);
27
+ const _DetailsRootCSS = DetailsRootCSS(theme);
23
28
  useImperativeHandle(reference, () => {
24
29
  const currentRef = ref.current || {};
25
30
  currentRef.element = ref.current;
@@ -32,7 +37,7 @@ const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
32
37
  });
33
38
  return useMemo(() => {
34
39
  return jsx("div", {
35
- css: DetailsRootCSS,
40
+ css: _DetailsRootCSS,
36
41
  className: 'DGN-UI-Accordion-Details',
37
42
  ref: ref,
38
43
  id: id
@@ -40,29 +45,35 @@ const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
40
45
  style: style,
41
46
  className: classNames('DGN-UI-Accordion-Details-Content', className)
42
47
  }, children));
43
- }, [children, className, id, style]);
48
+ }, [children, className, id, style, theme]);
44
49
  }));
45
- const DetailsRootCSS = css`
50
+ const DetailsRootCSS = ({
51
+ colors,
52
+ spacing,
53
+ typography
54
+ }) => css`
46
55
  ${positionRelative};
47
56
  ${overflowHidden};
48
57
  ${parseHeight(0)};
49
58
  transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
50
59
  .DGN-UI-Accordion-Details-Content {
51
60
  ${boxBorder};
52
- ${paragraph1};
53
- ${pd([0, 6, 4, 6])};
54
- ${textColor('text/main')};
61
+ ${typography.paragraph1};
62
+ padding: ${spacing([0, 6, 4, 6])};
63
+ ${textColor(getProp(colors, 'text/main'))};
55
64
  &.disabled {
56
65
  ${pointerEventsNone};
57
66
  ${userSelectNone};
58
67
  }
59
68
  }
60
69
  `;
61
- AccordionDetails.defaultProps = {
62
- className: '',
63
- id: '',
64
- style: {}
65
- };
70
+
71
+ // AccordionDetails.defaultProps = {
72
+ // className: '',
73
+ // id: '',
74
+ // style: {},
75
+ // };
76
+
66
77
  AccordionDetails.propTypes = {
67
78
  /** The content of the component. */
68
79
  children: PropTypes.node,
@@ -3,17 +3,28 @@
3
3
  import { css, jsx } from '@emotion/core';
4
4
  import PropTypes from 'prop-types';
5
5
  import { Children, cloneElement, forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
6
- import { borderRadius, borderRadius4px, mg } from "../../styles/general";
6
+ import { borderRadius, borderRadius4px } from "../../styles/general";
7
+ import { useTheme } from "../../theme";
8
+ import useThemeProps from "../../theme/utils/useThemeProps";
7
9
  import { classNames } from "../../utils";
8
- const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
- action = {},
10
- children,
11
- className,
12
- collapseOther,
13
- style
14
- }, reference) => {
10
+ const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
15
11
  if (!reference) reference = useRef(null);
12
+ const theme = useTheme();
13
+
14
+ // props priority: `inProps` > `themeDefaultProps`
15
+ const props = useThemeProps({
16
+ props: inProps,
17
+ name: 'AccordionGroup'
18
+ });
19
+ const {
20
+ action = {},
21
+ children,
22
+ className,
23
+ collapseOther,
24
+ style
25
+ } = props;
16
26
  const ref = useRef(null);
27
+ const _AccordionGroupRootCSS = AccordionGroupRootCSS(theme);
17
28
  const onCollapseOther = (e, onExpand) => {
18
29
  if (collapseOther) {
19
30
  const accordions = ref.current.querySelectorAll('.DGN-UI-Accordion');
@@ -38,7 +49,7 @@ const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
38
49
  });
39
50
  return useMemo(() => {
40
51
  return jsx("div", {
41
- css: AccordionGroupRootCSS,
52
+ css: _AccordionGroupRootCSS,
42
53
  ref: ref,
43
54
  style: style,
44
55
  className: classNames('DGN-UI-Accordion-Group', className)
@@ -47,7 +58,9 @@ const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
47
58
  })));
48
59
  }, [children, className, collapseOther, style]);
49
60
  }));
50
- const AccordionGroupRootCSS = css`
61
+ const AccordionGroupRootCSS = ({
62
+ spacing
63
+ }) => css`
51
64
  ${borderRadius4px};
52
65
  .DGN-UI-Accordion {
53
66
  &:first-of-type {
@@ -57,7 +70,7 @@ const AccordionGroupRootCSS = css`
57
70
  }
58
71
  &.expanding {
59
72
  ${borderRadius4px};
60
- ${mg([0, 0, 4, 0])};
73
+ margin: ${spacing([0, 0, 4, 0])};
61
74
  .DGN-UI-Divider {
62
75
  display: none !important;
63
76
  }
@@ -70,7 +83,7 @@ const AccordionGroupRootCSS = css`
70
83
  }
71
84
  &.expanding {
72
85
  ${borderRadius4px};
73
- ${mg([4, 0, 0, 0])};
86
+ margin: ${spacing([4, 0, 0, 0])};
74
87
  .DGN-UI-Accordion-Summary {
75
88
  border-radius: 4px 4px 0px 0px;
76
89
  }
@@ -86,7 +99,7 @@ const AccordionGroupRootCSS = css`
86
99
  }
87
100
  &.expanding {
88
101
  ${borderRadius4px};
89
- ${mg([4, 0])};
102
+ margin: ${spacing([4, 0])};
90
103
  .DGN-UI-Accordion-Summary {
91
104
  border-radius: 4px 4px 0px 0px;
92
105
  }
@@ -108,11 +121,13 @@ const AccordionGroupRootCSS = css`
108
121
  }
109
122
  }
110
123
  `;
111
- AccordionGroup.defaultProps = {
112
- className: '',
113
- collapseOther: true,
114
- style: {}
115
- };
124
+
125
+ // AccordionGroup.defaultProps = {
126
+ // className: '',
127
+ // collapseOther: true,
128
+ // style: {},
129
+ // };
130
+
116
131
  AccordionGroup.propTypes = {
117
132
  /** The content of the component. */
118
133
  children: PropTypes.node,
@@ -5,7 +5,9 @@ import { Divider } from "./..";
5
5
  import PropTypes from 'prop-types';
6
6
  import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
7
7
  import { bgColor, borderRadius4px, cursorNotAllowed, displayBlock, parseHeight, parseWidth, positionRelative, shadowNone } from "../../styles/general";
8
- import { classNames } from "../../utils";
8
+ import { useTheme } from "../../theme";
9
+ import useThemeProps from "../../theme/utils/useThemeProps";
10
+ import { classNames, getProp } from "../../utils";
9
11
  import AccordionContext from "./context";
10
12
  const handleTransition = (timer, el, beginHeight, endHeight = null) => {
11
13
  const getAutoHeightDuration = height => {
@@ -27,26 +29,34 @@ const handleTransition = (timer, el, beginHeight, endHeight = null) => {
27
29
  el.style.height = endHeight;
28
30
  }, duration);
29
31
  };
30
- const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
31
- action = {},
32
- boxShadow,
33
- children,
34
- className,
35
- disabled,
36
- expand,
37
- expanded,
38
- fullHeight,
39
- id,
40
- onClick,
41
- onCollapse,
42
- onExpand,
43
- style
44
- }, reference) => {
32
+ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
45
33
  if (!reference) reference = useRef(null);
34
+ const theme = useTheme();
35
+
36
+ // props priority: `inProps` > `themeDefaultProps`
37
+ const props = useThemeProps({
38
+ props: inProps,
39
+ name: 'Accordion'
40
+ });
41
+ const {
42
+ action = {},
43
+ boxShadow,
44
+ children,
45
+ className,
46
+ disabled,
47
+ expand,
48
+ expanded,
49
+ fullHeight,
50
+ id,
51
+ onClick,
52
+ onCollapse,
53
+ onExpand,
54
+ style
55
+ } = props;
46
56
  const ref = useRef(null);
47
57
  const timer = useRef(null);
48
58
  const [expandState, setExpandState] = useState(expanded || expand);
49
- const _AccordionRootCSS = AccordionRootCSS(fullHeight, expandState);
59
+ const _AccordionRootCSS = AccordionRootCSS(fullHeight, expandState, theme);
50
60
  useEffect(() => {
51
61
  if (ref.current) {
52
62
  if (fullHeight) {
@@ -104,15 +114,17 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
104
114
  display: 'none'
105
115
  }
106
116
  })));
107
- }, [boxShadow, children, className, disabled, expand, expanded, fullHeight, id, onClick, onCollapse, onExpand, style, expandState]);
117
+ }, [boxShadow, children, className, disabled, expand, expanded, fullHeight, id, onClick, onCollapse, onExpand, style, expandState, theme]);
108
118
  }));
109
- const AccordionRootCSS = (fullHeight, expandState) => css`
119
+ const AccordionRootCSS = (fullHeight, expandState, {
120
+ colors
121
+ }) => css`
110
122
  ${displayBlock};
111
123
  ${positionRelative};
112
124
  ${borderRadius4px};
113
125
  ${parseWidth('100%')};
114
126
  ${fullHeight && expandState && parseHeight('100%')};
115
- ${bgColor('system/white')};
127
+ ${bgColor(getProp(colors, 'system/standard'))};
116
128
  transition: margin 300ms ease, height 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
117
129
  `;
118
130
  const AccordionRootBoxShadowCSS = css`
@@ -122,14 +134,16 @@ const AccordionRootDisabledCSS = css`
122
134
  ${cursorNotAllowed};
123
135
  ${shadowNone};
124
136
  `;
125
- Accordion.defaultProps = {
126
- boxShadow: true,
127
- className: '',
128
- disabled: false,
129
- expand: false,
130
- fullHeight: false,
131
- style: {}
132
- };
137
+
138
+ // Accordion.defaultProps = {
139
+ // boxShadow: true,
140
+ // className: '',
141
+ // disabled: false,
142
+ // expand: false,
143
+ // fullHeight: false,
144
+ // style: {},
145
+ // };
146
+
133
147
  Accordion.propTypes = {
134
148
  /** The box-shadow of component. */
135
149
  boxShadow: PropTypes.bool,
@@ -4,37 +4,38 @@ import { css, jsx } from '@emotion/core';
4
4
  import { ButtonIcon, Typography } from "./..";
5
5
  import PropTypes from 'prop-types';
6
6
  import { forwardRef, memo, useContext, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
7
- import { bgColor, bgTransparent, borderRadius4px, boxBorder, breakWord, cursorPointer, displayFlex, displayInlineBlock, displayInlineFlex, flexRow, flexRowReverse, inset, itemsCenter, justifyBetween, justifyCenter, justifyEnd, mgl, mgr, parseMaxWidthHeight, parseMinHeight, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionRelative, textColor, userSelectNone } from "../../styles/general";
7
+ import { bgColor, bgTransparent, borderRadius4px, boxBorder, breakWord, cursorPointer, displayFlex, displayInlineBlock, displayInlineFlex, flexRow, flexRowReverse, inset, itemsCenter, justifyBetween, justifyCenter, justifyEnd, parseMaxWidthHeight, parseMinHeight, parseMinWidthHeight, parseWidth, parseWidthHeight, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionRelative, textColor, userSelectNone } from "../../styles/general";
8
8
  import { useTheme } from "../../theme";
9
- import { classNames } from "../../utils";
9
+ import { classNames, getProp } from "../../utils";
10
10
  import AccordionContext from "./context";
11
- const {
12
- colors: {
13
- system: {
14
- active: systemActive,
15
- disabled: systemDisabled
16
- }
17
- },
18
- typography: {
19
- heading3
20
- },
21
- spacing
22
- } = useTheme();
23
- const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
24
- action = {},
25
- background,
26
- children,
27
- className,
28
- collapseIcon,
29
- expandIcon,
30
- expandIconAt,
31
- expandIconProps,
32
- id,
33
- onClick,
34
- style,
35
- title
36
- }, reference) => {
11
+ import useThemeProps from "../../theme/utils/useThemeProps";
12
+ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
37
13
  if (!reference) reference = useRef(null);
14
+ const theme = useTheme();
15
+ const {
16
+ colors,
17
+ spacing
18
+ } = theme;
19
+
20
+ // props priority: `inProps` > `themeDefaultProps`
21
+ const props = useThemeProps({
22
+ props: inProps,
23
+ name: 'AccordionSummary'
24
+ });
25
+ const {
26
+ action = {},
27
+ background: backgroundProp,
28
+ children,
29
+ className,
30
+ collapseIcon,
31
+ expandIcon,
32
+ expandIconAt,
33
+ expandIconProps,
34
+ id,
35
+ onClick,
36
+ style,
37
+ title
38
+ } = props;
38
39
  const {
39
40
  expanded,
40
41
  expandState,
@@ -49,7 +50,8 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
49
50
  const ref = useRef(null);
50
51
  const expandIconRef = useRef(null);
51
52
  const timer = useRef(null);
52
- const _SummaryRootCSS = SummaryRootCSS(background);
53
+ const background = getProp(colors, backgroundProp, backgroundProp);
54
+ const _SummaryRootCSS = SummaryRootCSS(background, theme);
53
55
  const _onClick = e => {
54
56
  if (disabled) return;
55
57
  const target = e.target;
@@ -139,9 +141,13 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
139
141
  }) : jsx("span", {
140
142
  className: 'Accordion-Collapse-Icon effect'
141
143
  }, collapseIcon)))));
142
- }, [background, children, className, collapseIcon, expandIcon, expandIconAt, expandIconProps, id, onClick, style, title, disabled, expanded, expandState, onClickAccordion, onCollapse, onExpand]);
144
+ }, [children, className, collapseIcon, expandIcon, expandIconAt, expandIconProps, id, onClick, style, title, background, disabled, expanded, expandState, onClickAccordion, theme, onCollapse, onExpand]);
143
145
  }));
144
- const SummaryRootCSS = background => css`
146
+ const SummaryRootCSS = (background, {
147
+ colors,
148
+ spacing,
149
+ typography
150
+ }) => css`
145
151
  ${displayFlex};
146
152
  ${flexRow};
147
153
  ${positionRelative};
@@ -152,17 +158,17 @@ const SummaryRootCSS = background => css`
152
158
  ${borderRadius4px};
153
159
  ${parseWidth('100%')};
154
160
  ${parseMinHeight(56)};
155
- ${pd([4, 6])};
161
+ padding: ${spacing([4, 6])};
156
162
  ${bgColor(background)};
157
163
  .Accordion-Expand-Icon,
158
164
  .Accordion-Collapse-Icon {
159
165
  ${cursorPointer};
160
- color: ${systemActive} !important;
166
+ color: ${getProp(colors, 'system/active')} !important;
161
167
  &:active,
162
168
  &:focus,
163
169
  &:hover {
164
170
  ${bgColor('transparent')};
165
- ${textColor('system/active')};
171
+ ${textColor(getProp(colors, 'system/active'))};
166
172
  }
167
173
  }
168
174
  .Accordion-Icon-Root {
@@ -184,7 +190,7 @@ const SummaryRootCSS = background => css`
184
190
  ${flexRowReverse};
185
191
  ${justifyEnd};
186
192
  .Accordion-Icon.rotate-able {
187
- ${mgr([2])};
193
+ margin-right: ${spacing([2])};
188
194
  &.TreeView {
189
195
  transform: rotateZ(-90deg);
190
196
  }
@@ -192,7 +198,7 @@ const SummaryRootCSS = background => css`
192
198
  }
193
199
  &.end {
194
200
  .Accordion-Icon.rotate-able {
195
- ${mgl([2])};
201
+ margin-left: ${spacing([2])};
196
202
  &.TreeView {
197
203
  transform: rotateZ(90deg);
198
204
  }
@@ -220,21 +226,21 @@ const SummaryRootCSS = background => css`
220
226
  &:not(.disabled) {
221
227
  transition: background-color 300ms ease;
222
228
  &:hover {
223
- ${bgColor('fill.hover')};
229
+ ${bgColor(getProp(colors, 'fill/hover'))};
224
230
  }
225
231
  &:focus {
226
- ${bgColor('fill.focus')};
232
+ ${bgColor(getProp(colors, 'fill/focus'))};
227
233
  }
228
234
  &:active {
229
- ${bgColor('fill.pressed')};
235
+ ${bgColor(getProp(colors, 'fill/pressed'))};
230
236
  }
231
237
  }
232
238
  &.disabled {
233
239
  ${pointerEventsNone};
234
- ${bgColor('fill.disabled')};
240
+ ${bgColor(getProp(colors, 'fill/disabled'))};
235
241
  .DGN-UI-Accordion-Summary-Content,
236
242
  .Accordion-Expand-Icon {
237
- color: ${systemDisabled} !important;
243
+ color: ${getProp(colors, 'system/disabled')} !important;
238
244
  }
239
245
  }
240
246
  &.treeview-disabled {
@@ -243,7 +249,7 @@ const SummaryRootCSS = background => css`
243
249
  ${bgTransparent};
244
250
  }
245
251
  .TreeView-Item {
246
- ${textColor('system.disabled')};
252
+ ${textColor(getProp(colors, 'system/disabled'))};
247
253
  }
248
254
  .Accordion-Icon.rotate-able.TreeView .DGN-UI-Icon {
249
255
  ${cursorPointer};
@@ -251,14 +257,14 @@ const SummaryRootCSS = background => css`
251
257
  }
252
258
  }
253
259
  .DGN-UI-Accordion-Summary-Content {
254
- ${heading3};
260
+ ${typography.heading3};
255
261
  ${flexRow};
256
262
  ${positionRelative};
257
263
  ${breakWord};
258
264
  ${userSelectNone};
259
265
  ${boxBorder}
260
266
  ${itemsCenter};
261
- ${textColor('system.active')};
267
+ ${textColor(getProp(colors, 'system/active'))};
262
268
  ${parseWidth('100%')};
263
269
  ${parseMinHeight(24)};
264
270
  }
@@ -291,14 +297,16 @@ const SummaryRootCSS = background => css`
291
297
  }
292
298
  }
293
299
  `;
294
- AccordionSummary.defaultProps = {
295
- background: 'system/white',
296
- className: '',
297
- expandIcon: 'ArrowRight',
298
- expandIconAt: 'start',
299
- expandIconProps: {},
300
- style: {}
301
- };
300
+
301
+ // AccordionSummary.defaultProps = {
302
+ // background: 'system/standard',
303
+ // className: '',
304
+ // expandIcon: 'ArrowRight',
305
+ // expandIconAt: 'start',
306
+ // expandIconProps: {},
307
+ // style: {},
308
+ // };
309
+
302
310
  AccordionSummary.propTypes = {
303
311
  /** Background for label summary. */
304
312
  background: PropTypes.string,