diginet-core-ui 1.4.20 → 1.4.21
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.
- package/components/accordion/details.js +36 -25
- package/components/accordion/group.js +33 -18
- package/components/accordion/index.js +42 -28
- package/components/accordion/summary.js +60 -52
- package/components/alert/index.js +84 -75
- package/components/alert/notify.js +43 -31
- package/components/avatar/index.js +77 -75
- package/components/badge/index.js +62 -60
- package/components/breadcrumb/index.js +62 -44
- package/components/button/icon.js +69 -49
- package/components/button/index.js +97 -75
- package/components/button/more.js +60 -39
- package/components/button/ripple-effect.js +1 -1
- package/components/card/body.js +25 -15
- package/components/card/extra.js +25 -15
- package/components/card/footer.js +25 -15
- package/components/card/header.js +26 -15
- package/components/card/index.js +66 -57
- package/components/chart/bar/Labels.js +14 -8
- package/components/chart/bar-v2/Labels.js +14 -8
- package/components/chart/line/Labels.js +14 -8
- package/components/chart/line/Path.js +3 -3
- package/components/chart/line/Point.js +12 -11
- package/components/chart/line-v2/Labels.js +14 -8
- package/components/check-text/index.js +21 -16
- package/components/check-text/interview-confirmation.js +21 -15
- package/components/check-text/interview-status.js +21 -15
- package/components/chip/attach.js +6 -2
- package/components/chip/index.js +83 -82
- package/components/collapse/index.js +1 -1
- package/components/dialogs/colors.js +13 -11
- package/components/divider/index.js +40 -22
- package/components/form-control/attachment/index.js +73 -37
- package/components/form-control/calendar/function.js +43 -39
- package/components/form-control/calendar/index.js +32 -20
- package/components/form-control/calendar/range.js +38 -22
- package/components/form-control/checkbox/index.js +83 -59
- package/components/form-control/control/index.js +9 -10
- package/components/form-control/date-picker/index.js +81 -64
- package/components/form-control/date-range-picker/index.js +92 -75
- package/components/form-control/dropdown/index.js +197 -172
- package/components/form-control/dropdown-box/index.js +56 -43
- package/components/form-control/form-group/index.js +7 -6
- package/components/form-control/helper-text/index.js +45 -41
- package/components/form-control/input-base/index.js +165 -132
- package/components/form-control/label/index.js +48 -41
- package/components/form-control/money-input/index.js +76 -68
- package/components/form-control/number-input/index.js +579 -521
- package/components/form-control/number-input/index2.js +86 -69
- package/components/form-control/password-input/index.js +67 -59
- package/components/form-control/radio/index.js +85 -69
- package/components/form-control/text-input/index.js +79 -70
- package/components/form-control/time-picker/index.js +79 -56
- package/components/form-control/toggle/index.js +140 -129
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +34 -31
- package/components/form-view/input.js +70 -69
- package/components/form-view/label.js +14 -9
- package/components/grid/Col.js +48 -39
- package/components/grid/Container.js +31 -38
- package/components/grid/Row.js +28 -32
- package/components/grid/index.js +66 -54
- package/components/image/index.js +37 -27
- package/components/list/list-item-action.js +36 -26
- package/components/list/list-item-icon.js +34 -29
- package/components/list/list-item-text.js +27 -22
- package/components/list/list-item.js +42 -36
- package/components/list/list.js +46 -38
- package/components/list/sub-header.js +33 -26
- package/components/modal/body.js +24 -14
- package/components/modal/footer.js +23 -13
- package/components/modal/header.js +39 -28
- package/components/modal/index.js +3 -3
- package/components/modal/modal.js +60 -49
- package/components/others/extra/index.js +31 -30
- package/components/others/import/index.js +2 -2
- package/components/others/scrollbar/index.js +32 -26
- package/components/paging/page-info.js +33 -34
- package/components/paging/page-selector.js +15 -15
- package/components/paper/index.js +32 -28
- package/components/popover/body.js +14 -8
- package/components/popover/footer.js +13 -8
- package/components/popover/header.js +17 -15
- package/components/popover/index.js +71 -60
- package/components/popup/danger_popup.js +17 -16
- package/components/popup/index.js +16 -17
- package/components/popup/v2/index.js +28 -41
- package/components/progress/circular.js +65 -80
- package/components/progress/linear.js +73 -58
- package/components/rating/index.js +41 -55
- package/components/slider/slider-container.js +49 -57
- package/components/slider/slider-item.js +30 -29
- package/components/status/index.js +23 -34
- package/components/tab/tab-header.js +20 -11
- package/components/tab/tab-panel.js +12 -7
- package/components/tab/tab.js +35 -22
- package/components/tooltip/index.js +24 -35
- package/components/transfer/index.js +102 -103
- package/components/tree-view/index.js +99 -81
- package/components/typography/index.js +62 -45
- package/global/index.js +2 -17
- package/icons/basic.js +975 -972
- package/icons/effect.js +8 -7
- package/package.json +4 -2
- package/readme.md +1022 -880
- package/styles/color-helper.js +2 -2
- package/styles/colors.js +168 -30
- package/styles/general.js +73 -5
- package/styles/sx/index.js +7 -4
- package/styles/utils.js +6 -5
- package/theme/createSpacing.js +10 -0
- package/theme/createTheme.js +26 -0
- package/theme/createZIndex.js +9 -0
- package/theme/index.js +13 -2
- package/theme/make-styles.js +2 -1
- package/theme/settings.js +700 -8
- package/theme/theme-provider.js +32 -15
- package/theme/theme.js +57 -56
- package/theme/use-classes.js +15 -0
- package/theme/utils/getThemeProps.js +12 -0
- package/theme/utils/resolveProps.js +17 -0
- package/theme/utils/useThemeProps.js +14 -0
- package/utils/handleBreakpoints.js +2 -2
- package/utils/hexToRGBA/index.js +2 -2
- package/utils/object/deepmerge.js +104 -0
- package/utils/object/object.js +7 -12
- package/utils/render-portal.js +4 -3
- package/theme/set-theme.js +0 -38
|
@@ -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,
|
|
6
|
+
import { boxBorder, overflowHidden, parseHeight, pointerEventsNone, positionRelative, textColor, userSelectNone } from "../../styles/general";
|
|
7
7
|
import { useTheme } from "../../theme";
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
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:
|
|
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 =
|
|
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
|
-
${
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
|
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:
|
|
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 =
|
|
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
|
-
${
|
|
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
|
-
${
|
|
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
|
-
${
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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 {
|
|
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
|
|
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/
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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,
|
|
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
|
-
|
|
12
|
-
|
|
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
|
|
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
|
-
}, [
|
|
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
|
|
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
|
-
${
|
|
161
|
+
padding: ${spacing([4, 6])};
|
|
156
162
|
${bgColor(background)};
|
|
157
163
|
.Accordion-Expand-Icon,
|
|
158
164
|
.Accordion-Collapse-Icon {
|
|
159
165
|
${cursorPointer};
|
|
160
|
-
color: ${
|
|
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
|
-
${
|
|
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
|
-
${
|
|
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
|
|
229
|
+
${bgColor(getProp(colors, 'fill/hover'))};
|
|
224
230
|
}
|
|
225
231
|
&:focus {
|
|
226
|
-
${bgColor('fill
|
|
232
|
+
${bgColor(getProp(colors, 'fill/focus'))};
|
|
227
233
|
}
|
|
228
234
|
&:active {
|
|
229
|
-
${bgColor('fill
|
|
235
|
+
${bgColor(getProp(colors, 'fill/pressed'))};
|
|
230
236
|
}
|
|
231
237
|
}
|
|
232
238
|
&.disabled {
|
|
233
239
|
${pointerEventsNone};
|
|
234
|
-
${bgColor('fill
|
|
240
|
+
${bgColor(getProp(colors, 'fill/disabled'))};
|
|
235
241
|
.DGN-UI-Accordion-Summary-Content,
|
|
236
242
|
.Accordion-Expand-Icon {
|
|
237
|
-
color: ${
|
|
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
|
|
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
|
|
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
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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,
|