diginet-core-ui 1.4.21 → 1.4.22
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/assets/images/menu/dhr/MHRP39N0020.svg +9 -0
- package/assets/images/menu/dhr/MHRP39N0021.svg +7 -0
- package/components/accordion/details.js +12 -14
- package/components/accordion/group.js +12 -14
- package/components/accordion/index.js +36 -38
- package/components/accordion/summary.js +50 -51
- package/components/form-control/time-picker/v2/index.js +792 -0
- package/components/image/index.js +22 -24
- package/components/index.js +1 -1
- package/components/modal/body.js +9 -11
- package/components/modal/footer.js +8 -10
- package/components/modal/header.js +27 -25
- package/components/modal/modal.js +33 -32
- package/components/tab/tab-container.js +57 -49
- package/components/tab/tab-header.js +70 -64
- package/components/tab/tab-panel.js +38 -32
- package/components/tab/tab.js +69 -61
- package/global/index.js +4 -0
- package/package.json +1 -1
- package/readme.md +13 -4
- package/theme/settings.js +54 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M24.1 26.4C24.1 25.8 23.6 25.3 22.9 25.3H9.1C8.5 25.3 7.9 25.8 7.9 26.4C7.9 27 8.4 27.5 9.1 27.5H23C23.6 27.6 24.1 27 24.1 26.4Z" fill="#2680EB"/>
|
|
3
|
+
<path d="M23 20.7H9.1C8.5 20.7 7.9 21.2 7.9 21.8C7.9 22.4 8.4 23 9.1 23H23C23.6 23 24.2 22.5 24.2 21.9C24.2 21.3 23.6 20.7 23 20.7Z" fill="#2680EB"/>
|
|
4
|
+
<path d="M9.1 29.8C8.5 29.8 7.9 30.3 7.9 30.9C7.9 31.5 8.4 32 9.1 32H18.3C18.9 32 19.5 31.5 19.5 30.9C19.5 30.3 19 29.8 18.3 29.8H9.1Z" fill="#2680EB"/>
|
|
5
|
+
<path d="M29.7 34.6V35.6C29.7 36.2 29.2 36.7 28.5 36.7H5.5C4.9 36.7 4.3 36.2 4.3 35.6V3.4C4.3 2.8 4.8 2.3 5.5 2.3H20.5V8C20.5 9.9 22.1 11.4 24 11.4H32V10.3C32 10 31.9 9.7 31.7 9.5L22.5 0.4C22.3 0.1 22 0 21.7 0H5.5C3.6 0 2 1.5 2 3.4V35.5C2 37.5 3.6 39 5.5 39H28.6C30.5 39 32.1 37.5 32.1 35.6V34.6H29.7ZM22.8 3.9L28.1 9.1H24C23.4 9.1 22.8 8.6 22.8 8V3.9Z" fill="#2680EB"/>
|
|
6
|
+
<path d="M36.0001 17.9C35.8001 17.9 35.8001 17.9 35.7001 17.9L35.2001 18.4C35.2001 18.4 35.1001 18.5 35.1001 18.6V20.4C35.1001 20.7 35.0001 21 34.8001 21.2C34.6001 21.4 34.3001 21.5 34.0001 21.5H28.1001C27.8001 21.5 27.5001 21.4 27.3001 21.2C27.1001 21 27.0001 20.7 27.0001 20.4V14.5C27.0001 14.2 27.1001 13.9 27.3001 13.7C27.5001 13.5 27.8001 13.4 28.1001 13.4H34.0001C34.1001 13.4 34.2001 13.4 34.3001 13.4H34.4001C34.5001 13.4 34.5001 13.4 34.6001 13.3L35.0001 13C35.1001 12.9 35.1001 12.9 35.1001 12.8C35.1001 12.7 35.0001 12.7 35.0001 12.6C34.7001 12.5 34.5001 12.4 34.2001 12.4H28.3001C27.7001 12.4 27.2001 12.6 26.8001 13C26.4001 13.4 26.2001 13.9 26.2001 14.4V20.3C26.2001 20.9 26.4001 21.3 26.8001 21.7C27.2001 22.1 27.7001 22.3 28.3001 22.3H34.2001C34.8001 22.3 35.3001 22.1 35.7001 21.7C36.1001 21.3 36.3001 20.8 36.3001 20.3V18C36.1001 18 36.1001 17.9 36.0001 17.9ZM37.8001 13.8L37.0001 13C36.9001 12.9 36.7001 12.8 36.6001 12.8C36.4001 12.8 36.3001 12.9 36.2001 13L31.6001 17.6L29.7001 15.7C29.6001 15.6 29.4001 15.5 29.3001 15.5C29.1001 15.5 29.0001 15.6 28.9001 15.7L28.1001 16.5C28.0001 16.6 27.9001 16.8 27.9001 16.9C27.9001 17.1 28.0001 17.2 28.1001 17.3L31.2001 20.3C31.3001 20.4 31.5001 20.5 31.6001 20.5C31.8001 20.5 31.9001 20.4 32.0001 20.3L37.8001 14.5C37.9001 14.4 38.0001 14.2 38.0001 14.1C37.9001 14.1 37.9001 13.9 37.8001 13.8Z" fill="#F58B1F"/>
|
|
7
|
+
<path d="M36.0001 29.1C35.8001 29.1 35.8001 29.1 35.7001 29.2L35.2001 29.6C35.2001 29.6 35.1001 29.7 35.1001 29.8V31.6C35.1001 31.9 35.0001 32.2 34.8001 32.4C34.6001 32.6 34.3001 32.7 34.0001 32.7H28.0001C27.7001 32.7 27.4001 32.6 27.2001 32.4C27.0001 32.2 26.9001 31.9 26.9001 31.6V25.7C26.9001 25.4 27.0001 25.1 27.2001 24.9C27.4001 24.7 27.7001 24.6 28.0001 24.6H33.9001C34.0001 24.6 34.1001 24.6 34.2001 24.6H34.3001C34.4001 24.6 34.4001 24.6 34.5001 24.5L34.9001 24.1C35.0001 24 35.0001 24 35.0001 23.9C35.0001 23.8 34.9001 23.8 34.9001 23.7C34.6001 23.6 34.4001 23.5 34.1001 23.5H28.2001C27.6001 23.5 27.1001 23.7 26.7001 24.1C26.3001 24.5 26.1001 25 26.1001 25.5V31.4C26.1001 32 26.3001 32.4 26.7001 32.8C27.1001 33.2 27.6001 33.4 28.2001 33.4H34.1001C34.7001 33.4 35.2001 33.2 35.6001 32.8C36.0001 32.4 36.2001 31.9 36.2001 31.4V29.1C36.2001 29.2 36.1001 29.1 36.0001 29.1ZM37.8001 25L37.0001 24.2C36.9001 24.1 36.7001 24 36.6001 24C36.4001 24 36.3001 24.1 36.2001 24.2L31.6001 28.8L29.7001 26.9C29.6001 26.8 29.4001 26.7 29.3001 26.7C29.1001 26.7 29.0001 26.8 28.9001 26.9L28.1001 27.7C28.0001 27.8 28.0001 28 28.0001 28.1C28.0001 28.2 28.1001 28.4 28.2001 28.5L31.3001 31.5C31.4001 31.6 31.6001 31.7 31.7001 31.7C31.9001 31.7 32.0001 31.6 32.1001 31.5L37.9001 25.7C38.0001 25.6 38.1001 25.4 38.1001 25.3C38.1001 25.2 37.9001 25.1 37.8001 25Z" fill="#F58B1F"/>
|
|
8
|
+
<path d="M19 17H18.2V6.8C18.2 6.2 17.7 5.7 17.1 5.7H15C14.9 5.3 14.5 5 14.1 5H8.9C8.5 5 8.1 5.4 8.1 5.8V17H7C6.7 17 6.5 17.2 6.5 17.5C6.5 17.8 6.7 18 7 18H14.1C14.6 18 14.9 17.6 14.9 17.2V6.6H17C17.1 6.6 17.2 6.7 17.2 6.7V17.4C17.2 17.7 17.4 17.9 17.7 17.9H19C19.3 17.9 19.5 17.7 19.5 17.4C19.5 17.2 19.3 17 19 17ZM13 12C12.5 12 12 11.5 12 11C12 10.5 12.5 10 13 10C13.5 10 14 10.5 14 11C14 11.5 13.5 12 13 12Z" fill="#2680EB"/>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M31.4 9.5L22.3 0.3C22 0.1 21.7 0 21.4 0H5.4C3.5 0 2 1.5 2 3.4V35.5C2 37.5 3.5 39 5.4 39H24.4C23.2 38.4 22.1 37.7 21.1 36.7H5.4C4.8 36.7 4.3 36.2 4.3 35.6V3.4C4.3 2.8 4.8 2.3 5.4 2.3H20.3V8C20.3 9.9 21.8 11.4 23.7 11.4H29.4V18C30.2 18 30.9 18.1 31.7 18.3V10.2C31.7 10 31.6 9.7 31.4 9.5ZM23.7 9.1C23.1 9.1 22.6 8.6 22.6 8V3.9L27.8 9.1H23.7Z" fill="#2680EB"/>
|
|
3
|
+
<path d="M19 17H18.2V6.8C18.2 6.2 17.7 5.7 17.1 5.7H15C14.9 5.3 14.5 5 14.1 5H8.9C8.5 5 8.1 5.4 8.1 5.8V17H7C6.7 17 6.5 17.2 6.5 17.5C6.5 17.8 6.7 18 7 18H14.1C14.6 18 14.9 17.6 14.9 17.2V6.6H17C17.1 6.6 17.2 6.7 17.2 6.7V17.4C17.2 17.7 17.4 17.9 17.7 17.9H19C19.3 17.9 19.5 17.7 19.5 17.4C19.5 17.2 19.3 17 19 17ZM13 12C12.5 12 12 11.5 12 11C12 10.5 12.5 10 13 10C13.5 10 14 10.5 14 11C14 11.5 13.5 12 13 12Z" fill="#2680EB"/>
|
|
4
|
+
<path d="M14 23.9C13.9 23.9 13.8 23.9 13.8 23.9L13.5 24.2V25.6C13.5 25.8 13.4 26 13.3 26.2C13.1 26.4 12.9 26.4 12.7 26.4H8.4C8.2 26.4 8 26.3 7.8 26.2C7.6 26 7.6 25.9 7.6 25.6V21.4C7.6 21.2 7.7 21 7.8 20.8C8 20.6 8.2 20.6 8.4 20.6H12.6C12.7 20.6 12.8 20.6 12.8 20.6H12.9L13.2 20.4C13.2 20.4 13.3 20.3 13.2 20.3C13.2 20.2 13.2 20.2 13.1 20.2C13.1 20 12.9 20 12.6 20H8.4C8 20 7.7 20.1 7.4 20.4C7.1 20.7 7 21 7 21.4V25.6C7 26 7.1 26.3 7.4 26.6C7.7 26.9 8 27 8.4 27H12.6C13 27 13.3 26.9 13.6 26.6C13.9 26.3 14 26 14 25.6V24C14.1 24 14.1 23.9 14 23.9ZM15.3 21L14.7 20.4C14.6 20.3 14.5 20.3 14.4 20.3C14.3 20.3 14.2 20.3 14.1 20.4L10.8 23.6L9.5 22.3C9.4 22.2 9.3 22.2 9.2 22.2C9.1 22.2 9 22.2 8.9 22.3L8.3 22.9C8.2 23 8.2 23.1 8.2 23.2C8.2 23.3 8.2 23.4 8.3 23.5L10.5 25.7C10.6 25.8 10.7 25.8 10.8 25.8C10.9 25.8 11 25.8 11.1 25.7L15.2 21.6C15.3 21.5 15.3 21.4 15.3 21.3C15.3 21.2 15.4 21.1 15.3 21Z" fill="#F58B1F"/>
|
|
5
|
+
<path d="M14 31.8C13.9 31.8 13.8 31.8 13.8 31.8L13.5 32.1V33.5C13.5 33.7 13.4 33.9 13.3 34.1C13.1 34.3 12.9 34.3 12.7 34.3H8.5C8.3 34.3 8.1 34.2 7.9 34.1C7.7 33.9 7.7 33.8 7.7 33.5V29.3C7.7 29.1 7.8 28.9 7.9 28.7C8.1 28.5 8.3 28.5 8.5 28.5H12.7C12.8 28.5 12.9 28.5 12.9 28.5H13L13.3 28.3C13.3 28.3 13.4 28.2 13.3 28.2C13.3 28.1 13.3 28.1 13.2 28.1C13 28 12.8 28 12.6 28H8.5C8.1 28 7.8 28.1 7.5 28.4C7.2 28.7 7 29 7 29.4V33.6C7 34 7.1 34.3 7.4 34.6C7.7 34.9 8 35 8.4 35H12.6C13 35 13.3 34.9 13.6 34.6C13.9 34.3 14 34 14 33.6V32C14.1 31.9 14.1 31.8 14 31.8ZM15.3 28.9L14.7 28.3C14.6 28.2 14.5 28.2 14.4 28.2C14.3 28.2 14.2 28.2 14.1 28.3L10.8 31.5L9.5 30.2C9.4 30.1 9.3 30.1 9.2 30.1C9.1 30.1 9 30.1 8.9 30.2L8.3 30.8C8.2 30.9 8.2 31 8.2 31.1C8.2 31.2 8.2 31.3 8.3 31.4L10.5 33.6C10.6 33.7 10.7 33.7 10.8 33.7C10.9 33.7 11 33.7 11.1 33.6L15.2 29.5C15.3 29.4 15.3 29.3 15.3 29.2C15.4 29.1 15.4 29 15.3 28.9Z" fill="#F58B1F"/>
|
|
6
|
+
<path d="M34.4 20.6C32.8 19.6 31 19 29 19C28.5 19 28.1 19 27.7 19.1C26.9 19.2 26 19.4 25.3 19.7C24.9 19.9 24.4 20.1 24 20.3C22 21.4 20.5 23.2 19.7 25.3C19.2 26.5 19 27.7 19 29C19 34.5 23.5 39 29 39C34.5 39 39 34.5 39 29C39 25.5 37.1 22.3 34.4 20.6ZM35.2 25.8L29.3 33.8C29 34.3 28.4 34.6 27.8 34.6H27.7C27.2 34.6 26.6 34.4 26.3 34L22.8 30.2C22.3 29.6 22.3 28.7 22.9 28.1C23.2 27.8 23.5 27.7 23.9 27.7C24.3 27.7 24.7 27.9 25 28.2L27.5 30.9L27.6 31C27.7 31 27.7 31 27.7 30.9L32.7 24.1C33 23.7 33.4 23.5 33.9 23.5C34.2 23.5 34.5 23.6 34.8 23.8C35.6 24.2 35.7 25.1 35.2 25.8Z" fill="#1CA261"/>
|
|
7
|
+
</svg>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { forwardRef, memo, useImperativeHandle,
|
|
5
|
+
import { forwardRef, memo, useImperativeHandle, useRef } from 'react';
|
|
6
6
|
import { boxBorder, overflowHidden, parseHeight, pointerEventsNone, positionRelative, textColor, userSelectNone } from "../../styles/general";
|
|
7
7
|
import { useTheme } from "../../theme";
|
|
8
8
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
@@ -35,17 +35,15 @@ const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, re
|
|
|
35
35
|
currentRef.instance = _instance;
|
|
36
36
|
return currentRef;
|
|
37
37
|
});
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}, children));
|
|
48
|
-
}, [children, className, id, style, theme]);
|
|
38
|
+
return jsx("div", {
|
|
39
|
+
css: _DetailsRootCSS,
|
|
40
|
+
className: 'DGN-UI-Accordion-Details',
|
|
41
|
+
ref: ref,
|
|
42
|
+
id: id
|
|
43
|
+
}, jsx("div", {
|
|
44
|
+
style: style,
|
|
45
|
+
className: classNames('DGN-UI-Accordion-Details-Content', className)
|
|
46
|
+
}, children));
|
|
49
47
|
}));
|
|
50
48
|
const DetailsRootCSS = ({
|
|
51
49
|
colors,
|
|
@@ -77,9 +75,9 @@ const DetailsRootCSS = ({
|
|
|
77
75
|
AccordionDetails.propTypes = {
|
|
78
76
|
/** The content of the component. */
|
|
79
77
|
children: PropTypes.node,
|
|
80
|
-
/**
|
|
78
|
+
/** CSS class for the component. */
|
|
81
79
|
className: PropTypes.string,
|
|
82
|
-
/**
|
|
80
|
+
/** Inline style object for the component. */
|
|
83
81
|
style: PropTypes.object
|
|
84
82
|
};
|
|
85
83
|
export default AccordionDetails;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { Children, cloneElement, forwardRef, memo, useImperativeHandle,
|
|
5
|
+
import { Children, cloneElement, forwardRef, memo, useImperativeHandle, useRef } from 'react';
|
|
6
6
|
import { borderRadius, borderRadius4px } from "../../styles/general";
|
|
7
7
|
import { useTheme } from "../../theme";
|
|
8
8
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
@@ -47,16 +47,14 @@ const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, refe
|
|
|
47
47
|
currentRef.instance = _instance;
|
|
48
48
|
return currentRef;
|
|
49
49
|
});
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
})));
|
|
59
|
-
}, [children, className, collapseOther, style]);
|
|
50
|
+
return jsx("div", {
|
|
51
|
+
css: _AccordionGroupRootCSS,
|
|
52
|
+
ref: ref,
|
|
53
|
+
style: style,
|
|
54
|
+
className: classNames('DGN-UI-Accordion-Group', className)
|
|
55
|
+
}, Children.map(children, child => child && /*#__PURE__*/cloneElement(child, {
|
|
56
|
+
onExpand: e => onCollapseOther(e, child.props.onExpand)
|
|
57
|
+
})));
|
|
60
58
|
}));
|
|
61
59
|
const AccordionGroupRootCSS = ({
|
|
62
60
|
spacing
|
|
@@ -131,11 +129,11 @@ const AccordionGroupRootCSS = ({
|
|
|
131
129
|
AccordionGroup.propTypes = {
|
|
132
130
|
/** The content of the component. */
|
|
133
131
|
children: PropTypes.node,
|
|
134
|
-
/**
|
|
132
|
+
/** CSS class for the component. */
|
|
135
133
|
className: PropTypes.string,
|
|
136
|
-
/** If `true`,
|
|
134
|
+
/** If `true`, collapses others when one is expanded. */
|
|
137
135
|
collapseOther: PropTypes.bool,
|
|
138
|
-
/**
|
|
136
|
+
/** Inline style object for the component. */
|
|
139
137
|
style: PropTypes.object
|
|
140
138
|
};
|
|
141
139
|
export default AccordionGroup;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import { Divider } from "./..";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { forwardRef, memo, useEffect, useImperativeHandle,
|
|
6
|
+
import { forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
7
7
|
import { bgColor, borderRadius4px, cursorNotAllowed, displayBlock, parseHeight, parseWidth, positionRelative, shadowNone } from "../../styles/general";
|
|
8
8
|
import { useTheme } from "../../theme";
|
|
9
9
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
@@ -30,6 +30,7 @@ const handleTransition = (timer, el, beginHeight, endHeight = null) => {
|
|
|
30
30
|
}, duration);
|
|
31
31
|
};
|
|
32
32
|
const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
33
|
+
var _ref$current;
|
|
33
34
|
if (!reference) reference = useRef(null);
|
|
34
35
|
const theme = useTheme();
|
|
35
36
|
|
|
@@ -87,34 +88,31 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference
|
|
|
87
88
|
currentRef.instance = _instance;
|
|
88
89
|
return currentRef;
|
|
89
90
|
});
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
})));
|
|
117
|
-
}, [boxShadow, children, className, disabled, expand, expanded, fullHeight, id, onClick, onCollapse, onExpand, style, expandState, theme]);
|
|
91
|
+
return jsx("div", {
|
|
92
|
+
id: id,
|
|
93
|
+
css: [_AccordionRootCSS, boxShadow && AccordionRootBoxShadowCSS, disabled && AccordionRootDisabledCSS],
|
|
94
|
+
ref: ref,
|
|
95
|
+
style: style,
|
|
96
|
+
className: classNames('DGN-UI-Accordion', disabled && 'disabled', expandState && 'expanding', className)
|
|
97
|
+
}, jsx(AccordionContext.Provider, {
|
|
98
|
+
value: {
|
|
99
|
+
expanded,
|
|
100
|
+
expandState,
|
|
101
|
+
disabled,
|
|
102
|
+
onClickAccordion: onClick ? onClickAccordion : null,
|
|
103
|
+
onExpand,
|
|
104
|
+
onCollapse,
|
|
105
|
+
setExpandState,
|
|
106
|
+
handleTransition,
|
|
107
|
+
fullHeight: fullHeight ? ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clientHeight) || 0 : 0
|
|
108
|
+
}
|
|
109
|
+
}, children, jsx(Divider, {
|
|
110
|
+
color: 'line/category',
|
|
111
|
+
style: {
|
|
112
|
+
margin: 0,
|
|
113
|
+
display: 'none'
|
|
114
|
+
}
|
|
115
|
+
})));
|
|
118
116
|
}));
|
|
119
117
|
const AccordionRootCSS = (fullHeight, expandState, {
|
|
120
118
|
colors
|
|
@@ -145,25 +143,25 @@ const AccordionRootDisabledCSS = css`
|
|
|
145
143
|
// };
|
|
146
144
|
|
|
147
145
|
Accordion.propTypes = {
|
|
148
|
-
/** The box-shadow of component. */
|
|
146
|
+
/** The box-shadow of the component. */
|
|
149
147
|
boxShadow: PropTypes.bool,
|
|
150
|
-
/** The content of the component (
|
|
148
|
+
/** The content of the component (consists of <AccordionSummary /> and <AccordionDetails />). */
|
|
151
149
|
children: PropTypes.node,
|
|
152
|
-
/**
|
|
150
|
+
/** CSS class for the component. */
|
|
153
151
|
className: PropTypes.string,
|
|
154
152
|
/** If `true`, the component is disabled. */
|
|
155
153
|
disabled: PropTypes.bool,
|
|
156
|
-
/** If `true`,
|
|
154
|
+
/** If `true`, expands immediately after render (without state management) (shouldn't use this). */
|
|
157
155
|
expand: PropTypes.bool,
|
|
158
|
-
/**
|
|
156
|
+
/** The expanded state of the accordion (with state management) (should use this). */
|
|
159
157
|
expanded: PropTypes.bool,
|
|
160
|
-
/** If `true`, Accordion height
|
|
158
|
+
/** If `true`, the Accordion will have a height of 100% of its parent. */
|
|
161
159
|
fullHeight: PropTypes.bool,
|
|
162
|
-
/** Callback fired when Accordion is collapsed. */
|
|
160
|
+
/** Callback function fired when the Accordion is collapsed. */
|
|
163
161
|
onCollapse: PropTypes.func,
|
|
164
|
-
/** Callback fired when Accordion is expanded. */
|
|
162
|
+
/** Callback function fired when the Accordion is expanded. */
|
|
165
163
|
onExpand: PropTypes.func,
|
|
166
|
-
/**
|
|
164
|
+
/** Inline style object for the component. */
|
|
167
165
|
style: PropTypes.object
|
|
168
166
|
};
|
|
169
167
|
export default Accordion;
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import { ButtonIcon, Typography } from "./..";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { forwardRef, memo, useContext, useEffect, useImperativeHandle,
|
|
6
|
+
import { forwardRef, memo, useContext, useEffect, useImperativeHandle, useRef } from 'react';
|
|
7
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 useThemeProps from "../../theme/utils/useThemeProps";
|
|
9
10
|
import { classNames, getProp } from "../../utils";
|
|
10
11
|
import AccordionContext from "./context";
|
|
11
|
-
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
12
12
|
const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
const theme = useTheme();
|
|
@@ -28,7 +28,7 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, re
|
|
|
28
28
|
children,
|
|
29
29
|
className,
|
|
30
30
|
collapseIcon,
|
|
31
|
-
expandIcon,
|
|
31
|
+
expandIcon: expandIconProp,
|
|
32
32
|
expandIconAt,
|
|
33
33
|
expandIconProps,
|
|
34
34
|
id,
|
|
@@ -47,6 +47,7 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, re
|
|
|
47
47
|
handleTransition,
|
|
48
48
|
fullHeight
|
|
49
49
|
} = useContext(AccordionContext);
|
|
50
|
+
const expandIcon = expandIconProp === true ? 'ArrowRight' : expandIconProp;
|
|
50
51
|
const ref = useRef(null);
|
|
51
52
|
const expandIconRef = useRef(null);
|
|
52
53
|
const timer = useRef(null);
|
|
@@ -104,44 +105,42 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, re
|
|
|
104
105
|
currentRef.instance = _instance;
|
|
105
106
|
return currentRef;
|
|
106
107
|
});
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}, collapseIcon)))));
|
|
144
|
-
}, [children, className, collapseIcon, expandIcon, expandIconAt, expandIconProps, id, onClick, style, title, background, disabled, expanded, expandState, onClickAccordion, theme, onCollapse, onExpand]);
|
|
108
|
+
return jsx("div", {
|
|
109
|
+
id: id,
|
|
110
|
+
css: _SummaryRootCSS,
|
|
111
|
+
ref: ref,
|
|
112
|
+
tabIndex: "-1",
|
|
113
|
+
onClick: _onClick,
|
|
114
|
+
style: style,
|
|
115
|
+
className: classNames('DGN-UI-Accordion-Summary', disabled && 'disabled', expandIcon && expandIconAt, expandState && 'expanding', className)
|
|
116
|
+
}, jsx("div", {
|
|
117
|
+
className: 'DGN-UI-Accordion-Summary-Content'
|
|
118
|
+
}, jsx(Typography, {
|
|
119
|
+
type: 'h3',
|
|
120
|
+
lineClamp: 2,
|
|
121
|
+
color: disabled ? 'system/disabled' : 'system/active',
|
|
122
|
+
style: {
|
|
123
|
+
marginRight: children && title ? spacing([4]) : 0
|
|
124
|
+
}
|
|
125
|
+
}, title || ''), children), !!expandIcon && jsx("div", {
|
|
126
|
+
className: 'Accordion-Icon-Root'
|
|
127
|
+
}, jsx("div", {
|
|
128
|
+
...expandIconProps,
|
|
129
|
+
ref: expandIconRef,
|
|
130
|
+
className: classNames('Accordion-Icon', !collapseIcon && 'rotate-able', expandIconProps === null || expandIconProps === void 0 ? void 0 : expandIconProps.className)
|
|
131
|
+
}, typeof expandIcon === 'string' ? jsx(ButtonIcon, {
|
|
132
|
+
viewType: 'ghost',
|
|
133
|
+
name: expandIcon,
|
|
134
|
+
className: 'Accordion-Expand-Icon'
|
|
135
|
+
}) : jsx("span", {
|
|
136
|
+
className: 'Accordion-Expand-Icon effect'
|
|
137
|
+
}, expandIcon), !!collapseIcon && (typeof collapseIcon === 'string' ? jsx(ButtonIcon, {
|
|
138
|
+
viewType: 'ghost',
|
|
139
|
+
name: collapseIcon,
|
|
140
|
+
className: 'Accordion-Collapse-Icon'
|
|
141
|
+
}) : jsx("span", {
|
|
142
|
+
className: 'Accordion-Collapse-Icon effect'
|
|
143
|
+
}, collapseIcon)))));
|
|
145
144
|
}));
|
|
146
145
|
const SummaryRootCSS = (background, {
|
|
147
146
|
colors,
|
|
@@ -308,23 +307,23 @@ const SummaryRootCSS = (background, {
|
|
|
308
307
|
// };
|
|
309
308
|
|
|
310
309
|
AccordionSummary.propTypes = {
|
|
311
|
-
/** Background for label summary. */
|
|
310
|
+
/** Background color for the label summary. */
|
|
312
311
|
background: PropTypes.string,
|
|
313
312
|
/** The content of the component. */
|
|
314
313
|
children: PropTypes.node,
|
|
315
|
-
/**
|
|
314
|
+
/** CSS class for the component. */
|
|
316
315
|
className: PropTypes.string,
|
|
317
|
-
/** Icon display for collapse icon. */
|
|
318
|
-
collapseIcon: PropTypes.
|
|
319
|
-
/** Icon display for expand icon. */
|
|
320
|
-
expandIcon: PropTypes.
|
|
321
|
-
/** Position to render icon. */
|
|
316
|
+
/** Icon to display for the collapse action. If `false`, the collapse icon is hidden. */
|
|
317
|
+
collapseIcon: PropTypes.oneOfType([PropTypes.bool, PropTypes.node, PropTypes.string]),
|
|
318
|
+
/** Icon to display for the expand action. If `false`, the expand icon is hidden. */
|
|
319
|
+
expandIcon: PropTypes.oneOfType([PropTypes.bool, PropTypes.node, PropTypes.string]),
|
|
320
|
+
/** Position to render the icon. */
|
|
322
321
|
expandIconAt: PropTypes.oneOf(['start', 'end']),
|
|
323
|
-
/**
|
|
322
|
+
/** Additional props for the icon. */
|
|
324
323
|
expandIconProps: PropTypes.any,
|
|
325
|
-
/** Callback fired when the component is clicked. */
|
|
324
|
+
/** Callback function fired when the component is clicked. */
|
|
326
325
|
onClick: PropTypes.func,
|
|
327
|
-
/**
|
|
326
|
+
/** Inline style object for the component. */
|
|
328
327
|
style: PropTypes.object,
|
|
329
328
|
/** The title of the component. */
|
|
330
329
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|