diginet-core-ui 1.3.73 → 1.3.74
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/MHRP29N0026.svg +13 -0
- package/assets/images/menu/dhr/MHRP29N0027.svg +14 -0
- package/assets/images/menu/dhr/MHRP29N0028.svg +15 -0
- package/components/accordion/details.js +19 -10
- package/components/accordion/group.js +15 -6
- package/components/accordion/index.js +20 -11
- package/components/accordion/summary.js +18 -9
- package/components/avatar/index.js +1 -1
- package/components/badge/index.js +17 -9
- package/components/button/icon.js +33 -25
- package/components/button/index.js +25 -17
- package/components/card/body.js +12 -4
- package/components/card/extra.js +12 -4
- package/components/card/footer.js +12 -4
- package/components/card/header.js +12 -4
- package/components/card/index.js +12 -4
- package/components/chip/index.js +6 -6
- package/components/form-control/attachment/index.js +197 -192
- package/components/form-control/date-picker/index.js +4 -2
- package/components/form-control/date-range-picker/index.js +15 -8
- package/components/form-control/dropdown/index.js +34 -13
- package/components/form-control/input-base/index.js +505 -483
- package/components/form-control/label/index.js +27 -21
- package/components/form-control/text-input/index.js +4 -1
- package/components/grid/Col.js +8 -7
- package/components/grid/Container.js +16 -15
- package/components/grid/Row.js +16 -15
- package/components/grid/index.js +17 -36
- package/components/image/index.js +164 -0
- package/components/index.js +3 -1
- package/components/modal/body.js +12 -9
- package/components/modal/footer.js +22 -11
- package/components/modal/header.js +25 -13
- package/components/modal/index.js +32 -30
- package/components/modal/modal.js +29 -25
- package/components/others/option-wrapper/index.js +5 -18
- package/components/paging/page-info.js +45 -33
- package/components/paging/page-selector2.js +45 -33
- package/components/popover/body.js +14 -6
- package/components/popover/footer.js +15 -6
- package/components/popover/header.js +17 -7
- package/components/popover/index.js +242 -109
- package/components/status/index.js +12 -4
- package/components/tab/tab-container.js +29 -27
- package/components/tab/tab-header.js +33 -28
- package/components/tab/tab-panel.js +31 -27
- package/components/tab/tab.js +45 -35
- package/components/tree-view/index.js +108 -73
- package/components/typography/index.js +36 -25
- package/icons/basic.js +248 -0
- package/icons/effect.js +44 -36
- package/package.json +1 -1
- package/readme.md +40 -0
- package/styles/general.js +23 -0
- package/theme/index.js +1 -1
- package/theme/set-theme.js +2 -1
- package/utils/index.js +13 -10
- package/utils/useMediaQuery.js +4 -2
|
@@ -4,18 +4,20 @@
|
|
|
4
4
|
import React, { forwardRef, useState, memo, useEffect, useRef, useImperativeHandle } from 'react';
|
|
5
5
|
import { jsx, css } from '@emotion/core';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { randomString } from '../../utils';
|
|
7
|
+
import { classNames, randomString, refType as ref } from '../../utils';
|
|
8
8
|
import TabContext from './context';
|
|
9
9
|
import { isNumeric } from '../../utils/type';
|
|
10
|
-
import Typography from '../typography';
|
|
11
10
|
import { flexCol, flexRow, positionRelative, parseWidth } from '../../styles/general';
|
|
11
|
+
import { arrTypeTypography as typesTypography } from '../typography';
|
|
12
12
|
const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
13
|
+
action = {},
|
|
13
14
|
children,
|
|
14
|
-
|
|
15
|
-
width,
|
|
15
|
+
className,
|
|
16
16
|
direction,
|
|
17
17
|
level,
|
|
18
|
-
|
|
18
|
+
style,
|
|
19
|
+
tabIndex,
|
|
20
|
+
width,
|
|
19
21
|
...props
|
|
20
22
|
}, reference) => {
|
|
21
23
|
const ref = useRef(null);
|
|
@@ -37,7 +39,9 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
37
39
|
}, [value, tabIndex]);
|
|
38
40
|
useImperativeHandle(reference, () => {
|
|
39
41
|
const currentRef = ref.current || {};
|
|
40
|
-
|
|
42
|
+
currentRef.element = ref.current;
|
|
43
|
+
const _instance = { ...action
|
|
44
|
+
}; // methods
|
|
41
45
|
|
|
42
46
|
_instance.__proto__ = {}; // hidden methods
|
|
43
47
|
|
|
@@ -46,9 +50,10 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
46
50
|
});
|
|
47
51
|
return jsx("div", {
|
|
48
52
|
css: _TabContainerCSS,
|
|
49
|
-
className: ['DGN-UI-Tab-Container', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
50
|
-
id: `DGN-${id}-tab-button-container`,
|
|
51
53
|
ref: ref,
|
|
54
|
+
id: `DGN-${id}-tab-button-container`,
|
|
55
|
+
className: classNames('DGN-UI-Tab-Container', className),
|
|
56
|
+
style: style,
|
|
52
57
|
...props
|
|
53
58
|
}, jsx(TabContext.Provider, {
|
|
54
59
|
value: {
|
|
@@ -68,44 +73,41 @@ const TabContainerCSS = (direction, width) => css`
|
|
|
68
73
|
`;
|
|
69
74
|
|
|
70
75
|
TabContainer.defaultProps = {
|
|
71
|
-
|
|
76
|
+
className: '',
|
|
72
77
|
direction: 'horizontal',
|
|
73
78
|
level: 'level1',
|
|
79
|
+
style: {},
|
|
74
80
|
tabIndex: 0,
|
|
75
|
-
|
|
76
|
-
style: {}
|
|
81
|
+
width: '100%'
|
|
77
82
|
};
|
|
78
|
-
const typesTypography = Typography.propTypes.type;
|
|
79
83
|
TabContainer.propTypes = {
|
|
80
|
-
/** Width of component. */
|
|
81
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
82
|
-
|
|
83
|
-
/** The value of the currently selected Tab. */
|
|
84
|
-
tabIndex: PropTypes.number,
|
|
85
|
-
|
|
86
84
|
/** The content of the component. */
|
|
87
85
|
children: PropTypes.node,
|
|
88
86
|
|
|
87
|
+
/** Class for component */
|
|
88
|
+
className: PropTypes.string,
|
|
89
|
+
|
|
89
90
|
/** Direction change the position of Tabs. */
|
|
90
91
|
direction: PropTypes.oneOf(['vertical', 'horizontal']),
|
|
91
92
|
|
|
92
93
|
/** Direction change the size typography of Tab (typesTypography is types of Typography - exp: h1, h2, h3, p1 ...). */
|
|
93
|
-
level: PropTypes.oneOfType([PropTypes.oneOf(['level1', 'level2'
|
|
94
|
-
|
|
95
|
-
/** Class for component */
|
|
96
|
-
className: PropTypes.string,
|
|
94
|
+
level: PropTypes.oneOfType([PropTypes.oneOf(['level1', 'level2', ...typesTypography])]),
|
|
97
95
|
|
|
98
96
|
/** Style inline of component. */
|
|
99
97
|
style: PropTypes.object,
|
|
100
98
|
|
|
99
|
+
/** The value of the currently selected Tab. */
|
|
100
|
+
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
101
|
+
|
|
102
|
+
/** Width of component. */
|
|
103
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
104
|
+
|
|
101
105
|
/** Any props else. */
|
|
102
106
|
props: PropTypes.any,
|
|
103
107
|
|
|
104
|
-
/**
|
|
105
|
-
* Ref methods.
|
|
108
|
+
/**
|
|
109
|
+
* Ref methods.
|
|
106
110
|
*/
|
|
107
|
-
reference:
|
|
108
|
-
current: PropTypes.instanceOf(Element)
|
|
109
|
-
})])
|
|
111
|
+
reference: ref
|
|
110
112
|
};
|
|
111
113
|
export default TabContainer;
|
|
@@ -4,22 +4,23 @@
|
|
|
4
4
|
import React, { memo, forwardRef, useContext, useRef, useState, useImperativeHandle } from 'react';
|
|
5
5
|
import { jsx, css } from '@emotion/core';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { color as colors } from '../../styles/colors';
|
|
8
7
|
import TabContext from './context';
|
|
9
8
|
import ButtonIcon from '../button/icon';
|
|
10
|
-
import { borderBox, displayNone, flexCol, flexRow, justifyCenter, overflowHidden, parseWidthHeight, positionRelative, whiteSpaceNoWrap } from '../../styles/general';
|
|
9
|
+
import { borderBox, displayNone, flexCol, flexRow, justifyCenter, overflowHidden, parseWidth, parseWidthHeight, positionRelative, whiteSpaceNoWrap } from '../../styles/general';
|
|
10
|
+
import { classNames, refType as ref } from '../../utils';
|
|
11
|
+
import theme from '../../theme/settings';
|
|
11
12
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
} = colors;
|
|
13
|
+
spacing
|
|
14
|
+
} = theme;
|
|
16
15
|
const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
16
|
+
action = {},
|
|
17
|
+
centered,
|
|
17
18
|
children,
|
|
18
|
-
style,
|
|
19
19
|
className,
|
|
20
20
|
level,
|
|
21
21
|
scrollButtons,
|
|
22
|
-
|
|
22
|
+
style,
|
|
23
|
+
width,
|
|
23
24
|
...props
|
|
24
25
|
}, reference) => {
|
|
25
26
|
var _ref$current, _ref$current2;
|
|
@@ -33,9 +34,9 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
33
34
|
let showScrollLeftButton = !isVertical && scrollLeft > 0;
|
|
34
35
|
let showScrollRightButton = !isVertical && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.offsetWidth) + scrollLeft < (ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.scrollWidth);
|
|
35
36
|
|
|
36
|
-
const _ContainerCSS = ContainerCSS(centered, isVertical);
|
|
37
|
+
const _ContainerCSS = ContainerCSS(centered, isVertical, width);
|
|
37
38
|
|
|
38
|
-
const _TabHeaderCSS = TabHeaderCSS(isVertical);
|
|
39
|
+
const _TabHeaderCSS = TabHeaderCSS(isVertical, width);
|
|
39
40
|
|
|
40
41
|
const scrollLeftButtonCSS = scrollButtonCSS(true, showScrollLeftButton, showScrollRightButton);
|
|
41
42
|
const scrollRightButtonCSS = scrollButtonCSS(false, showScrollLeftButton, showScrollRightButton);
|
|
@@ -48,7 +49,9 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
48
49
|
|
|
49
50
|
useImperativeHandle(reference, () => {
|
|
50
51
|
const currentRef = ref.current || {};
|
|
51
|
-
|
|
52
|
+
currentRef.element = ref.current;
|
|
53
|
+
const _instance = { ...action
|
|
54
|
+
}; // methods
|
|
52
55
|
|
|
53
56
|
_instance.__proto__ = {}; // hidden methods
|
|
54
57
|
|
|
@@ -58,7 +61,7 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
58
61
|
return jsx("div", {
|
|
59
62
|
css: _ContainerCSS,
|
|
60
63
|
id: `DGN-control`,
|
|
61
|
-
className:
|
|
64
|
+
className: classNames('DGN-UI-Tab-Header-Container', className),
|
|
62
65
|
style: style,
|
|
63
66
|
...props
|
|
64
67
|
}, scrollButtons && !isVertical && jsx(ButtonIcon, {
|
|
@@ -91,26 +94,26 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
91
94
|
}));
|
|
92
95
|
}));
|
|
93
96
|
|
|
94
|
-
const ContainerCSS = (centered, isVertical) => css`
|
|
97
|
+
const ContainerCSS = (centered, isVertical, width) => css`
|
|
95
98
|
${flexRow};
|
|
96
99
|
${overflowHidden};
|
|
97
100
|
${positionRelative};
|
|
98
101
|
${borderBox};
|
|
102
|
+
${parseWidthHeight(width, 'auto')};
|
|
99
103
|
${centered && justifyCenter};
|
|
100
104
|
flex-direction: ${isVertical ? 'column' : 'row'};
|
|
101
105
|
max-width: ${isVertical ? 'max-content' : '100%'};
|
|
102
|
-
height: auto;
|
|
103
|
-
width: 100%;
|
|
104
106
|
padding: 0;
|
|
105
|
-
${isVertical ? `border-right: solid 1px ${tab}` : `border-bottom: solid 1px ${tab}`};
|
|
106
107
|
`;
|
|
107
108
|
|
|
108
|
-
const TabHeaderCSS = isVertical => isVertical ? css`
|
|
109
|
+
const TabHeaderCSS = (isVertical, width) => isVertical ? css`
|
|
109
110
|
${flexCol};
|
|
111
|
+
${parseWidth(width)};
|
|
110
112
|
` : css`
|
|
111
113
|
${flexRow};
|
|
112
114
|
${positionRelative};
|
|
113
115
|
${whiteSpaceNoWrap};
|
|
116
|
+
${parseWidth(width)};
|
|
114
117
|
margin: 0;
|
|
115
118
|
overflow-x: auto;
|
|
116
119
|
scroll-behavior: smooth;
|
|
@@ -126,7 +129,7 @@ const scrollButtonCSS = (scrollPrevious, showScrollLeftButton, showScrollRightBu
|
|
|
126
129
|
${parseWidthHeight(24, 24)};
|
|
127
130
|
overflow: initial;
|
|
128
131
|
align-self: center;
|
|
129
|
-
margin: ${scrollPrevious ?
|
|
132
|
+
margin: ${scrollPrevious ? spacing([0, 2, 0, 0]) : spacing([0, 0, 0, 2])};
|
|
130
133
|
opacity: ${scrollPrevious && showScrollLeftButton || !scrollPrevious && showScrollRightButton ? '1' : '0'};
|
|
131
134
|
:disabled {
|
|
132
135
|
span {
|
|
@@ -136,26 +139,30 @@ const scrollButtonCSS = (scrollPrevious, showScrollLeftButton, showScrollRightBu
|
|
|
136
139
|
`;
|
|
137
140
|
|
|
138
141
|
TabHeader.defaultProps = {
|
|
139
|
-
|
|
142
|
+
centered: false,
|
|
140
143
|
className: '',
|
|
144
|
+
scrollButtons: false,
|
|
141
145
|
style: {},
|
|
142
|
-
|
|
146
|
+
width: '100%'
|
|
143
147
|
};
|
|
144
148
|
TabHeader.propTypes = {
|
|
149
|
+
/** If true, the tabs are centered. */
|
|
150
|
+
centered: PropTypes.bool,
|
|
151
|
+
|
|
145
152
|
/** Element to display in Tab header. */
|
|
146
153
|
children: PropTypes.array,
|
|
147
154
|
|
|
148
155
|
/** Class for component. */
|
|
149
156
|
className: PropTypes.string,
|
|
150
157
|
|
|
151
|
-
/** Style inline of component. */
|
|
152
|
-
style: PropTypes.object,
|
|
153
|
-
|
|
154
158
|
/** If true, show scroll buttons. */
|
|
155
159
|
scrollButtons: PropTypes.bool,
|
|
156
160
|
|
|
157
|
-
/**
|
|
158
|
-
|
|
161
|
+
/** Style inline of component. */
|
|
162
|
+
style: PropTypes.object,
|
|
163
|
+
|
|
164
|
+
/** Width of component. */
|
|
165
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
159
166
|
|
|
160
167
|
/** Any props else. */
|
|
161
168
|
props: PropTypes.any,
|
|
@@ -163,8 +170,6 @@ TabHeader.propTypes = {
|
|
|
163
170
|
/**
|
|
164
171
|
* Ref methods.
|
|
165
172
|
*/
|
|
166
|
-
reference:
|
|
167
|
-
current: PropTypes.instanceOf(Element)
|
|
168
|
-
})])
|
|
173
|
+
reference: ref
|
|
169
174
|
};
|
|
170
175
|
export default TabHeader;
|
|
@@ -4,20 +4,25 @@
|
|
|
4
4
|
import { memo, forwardRef, useContext, useRef, useEffect, useState, useImperativeHandle } from 'react';
|
|
5
5
|
import { jsx, css } from '@emotion/core';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { color as colors } from '../../styles/colors';
|
|
8
7
|
import TabContext from './context';
|
|
9
|
-
import { borderBox, displayNone, flexCol, positionRelative } from '../../styles/general';
|
|
8
|
+
import { borderBox, displayNone, flexCol, parseWidthHeight, positionRelative } from '../../styles/general';
|
|
9
|
+
import theme from '../../theme/settings';
|
|
10
|
+
import { classNames, refType as ref } from '../../utils';
|
|
10
11
|
const {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
12
|
+
colors: {
|
|
13
|
+
text: {
|
|
14
|
+
main
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
spacing
|
|
18
|
+
} = theme;
|
|
15
19
|
const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
20
|
+
action = {},
|
|
16
21
|
children,
|
|
17
|
-
index,
|
|
18
|
-
style,
|
|
19
22
|
className,
|
|
23
|
+
index,
|
|
20
24
|
lazyLoading,
|
|
25
|
+
style,
|
|
21
26
|
...props
|
|
22
27
|
}, reference) => {
|
|
23
28
|
const {
|
|
@@ -36,7 +41,9 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
36
41
|
}, [tabIndexState]);
|
|
37
42
|
useImperativeHandle(reference, () => {
|
|
38
43
|
const currentRef = ref.current || {};
|
|
39
|
-
|
|
44
|
+
currentRef.element = ref.current;
|
|
45
|
+
const _instance = { ...action
|
|
46
|
+
}; // methods
|
|
40
47
|
|
|
41
48
|
_instance.__proto__ = {}; // hidden methods
|
|
42
49
|
|
|
@@ -45,12 +52,12 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
45
52
|
});
|
|
46
53
|
return jsx("div", {
|
|
47
54
|
css: _TabPanelCSS,
|
|
55
|
+
ref: ref,
|
|
56
|
+
role: 'tab-panel',
|
|
48
57
|
"aria-labelledby": `tab-${index}`,
|
|
49
58
|
id: `tab-panel-${index}`,
|
|
50
|
-
className:
|
|
59
|
+
className: classNames('DGN-UI-Tab-Panel', className),
|
|
51
60
|
style: style,
|
|
52
|
-
role: 'tab-panel',
|
|
53
|
-
ref: ref,
|
|
54
61
|
...props
|
|
55
62
|
}, isActive || !lazyLoading || isRendered ? children : null);
|
|
56
63
|
}));
|
|
@@ -60,41 +67,38 @@ const TabPanelCSS = (isVertical, isActive) => css`
|
|
|
60
67
|
${borderBox};
|
|
61
68
|
${positionRelative};
|
|
62
69
|
${isActive ? flexCol : displayNone};
|
|
70
|
+
${parseWidthHeight('100%', isVertical ? 300 : '100%')}
|
|
63
71
|
color: ${main};
|
|
64
|
-
|
|
65
|
-
padding: 0px ${isVertical ? '12px' : '10'};
|
|
66
|
-
width: 100%;
|
|
72
|
+
padding: ${spacing([0, isVertical ? 3 : 2.5])};
|
|
67
73
|
`;
|
|
68
74
|
|
|
69
75
|
TabPanel.defaultProps = {
|
|
70
76
|
className: '',
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
lazyLoading: false,
|
|
78
|
+
style: {}
|
|
73
79
|
};
|
|
74
80
|
TabPanel.propTypes = {
|
|
75
81
|
/** The content of the component. */
|
|
76
82
|
children: PropTypes.node,
|
|
77
83
|
|
|
78
|
-
/** Index received in position of TabHeaderButton. */
|
|
79
|
-
index: PropTypes.number,
|
|
80
|
-
|
|
81
84
|
/** Class for component. */
|
|
82
85
|
className: PropTypes.string,
|
|
83
86
|
|
|
84
|
-
/**
|
|
85
|
-
|
|
87
|
+
/** Index received in position of TabHeaderButton. */
|
|
88
|
+
index: PropTypes.number,
|
|
86
89
|
|
|
87
90
|
/** Lazy loading mode. */
|
|
88
91
|
lazyLoading: PropTypes.bool,
|
|
89
92
|
|
|
93
|
+
/** Style inline of component. */
|
|
94
|
+
style: PropTypes.object,
|
|
95
|
+
|
|
90
96
|
/** Any props else. */
|
|
91
97
|
props: PropTypes.any,
|
|
92
98
|
|
|
93
|
-
/**
|
|
94
|
-
* Ref methods.
|
|
99
|
+
/**
|
|
100
|
+
* Ref methods.
|
|
95
101
|
*/
|
|
96
|
-
reference:
|
|
97
|
-
current: PropTypes.instanceOf(Element)
|
|
98
|
-
})])
|
|
102
|
+
reference: ref
|
|
99
103
|
};
|
|
100
104
|
export default TabPanel;
|
package/components/tab/tab.js
CHANGED
|
@@ -10,26 +10,33 @@ import Ripple from '../button/ripple-effect';
|
|
|
10
10
|
import Typography from '../typography';
|
|
11
11
|
import TabContext from './context';
|
|
12
12
|
import { alignCenter, backgroundTransparent, borderBox, boxShadowNone, breakWord, cursorDefault, cursorPointer, flexRow, justifyCenter, justifyStart, outlineNone, overflowHidden, pointerEventsNone, positionAbsolute, positionRelative, textCenter, whiteSpaceNoWrap } from '../../styles/general';
|
|
13
|
+
import { classNames, refType as ref } from '../../utils';
|
|
14
|
+
import theme from '../../theme/settings';
|
|
13
15
|
const {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
16
|
+
colors: {
|
|
17
|
+
system: {
|
|
18
|
+
active,
|
|
19
|
+
disabled: systemDisabled,
|
|
20
|
+
rest,
|
|
21
|
+
white
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
spacing
|
|
25
|
+
} = theme;
|
|
21
26
|
const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
22
|
-
|
|
27
|
+
action = {},
|
|
23
28
|
children,
|
|
29
|
+
className,
|
|
24
30
|
color,
|
|
25
31
|
disabled,
|
|
26
|
-
style,
|
|
27
|
-
className,
|
|
28
|
-
startIcon,
|
|
29
32
|
endIcon,
|
|
33
|
+
index,
|
|
30
34
|
label,
|
|
31
|
-
|
|
35
|
+
labelProps,
|
|
32
36
|
level,
|
|
37
|
+
onClick,
|
|
38
|
+
startIcon,
|
|
39
|
+
style,
|
|
33
40
|
...props
|
|
34
41
|
}, reference) => {
|
|
35
42
|
const {
|
|
@@ -51,7 +58,9 @@ const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
51
58
|
|
|
52
59
|
useImperativeHandle(reference, () => {
|
|
53
60
|
const currentRef = ref.current || {};
|
|
54
|
-
|
|
61
|
+
currentRef.element = ref.current;
|
|
62
|
+
const _instance = { ...action
|
|
63
|
+
}; // methods
|
|
55
64
|
|
|
56
65
|
_instance.__proto__ = {}; // hidden methods
|
|
57
66
|
|
|
@@ -89,12 +98,12 @@ const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
89
98
|
}, [endIcon]);
|
|
90
99
|
return jsx("div", {
|
|
91
100
|
css: _TabButtonCSS,
|
|
92
|
-
|
|
101
|
+
ref: ref,
|
|
102
|
+
className: classNames('DGN-UI-Tab-Item', disabled && 'disabled', index === tabIndexState && !disabled && 'selected', className),
|
|
93
103
|
style: style,
|
|
94
104
|
onClick: _onClick,
|
|
95
|
-
ref: ref,
|
|
96
105
|
...props
|
|
97
|
-
}, startIcon && StartIcon, jsx(Typography, {
|
|
106
|
+
}, startIcon && StartIcon, jsx(Typography, { ...labelProps,
|
|
98
107
|
type: level,
|
|
99
108
|
color: 'inherit'
|
|
100
109
|
}, label), children, endIcon && EndIcon, jsx(Ripple, null), jsx("span", {
|
|
@@ -120,9 +129,9 @@ const TabButtonCSS = (color, isVertical) => css`
|
|
|
120
129
|
background-color: ${white};
|
|
121
130
|
border: 0;
|
|
122
131
|
color: ${colors[color] || color || rest};
|
|
123
|
-
max-width:
|
|
124
|
-
min-width:
|
|
125
|
-
padding: ${isVertical ?
|
|
132
|
+
max-width: ${isVertical ? '100%' : '287px'};
|
|
133
|
+
min-width: 80px;
|
|
134
|
+
padding: ${isVertical ? spacing([3.5, 4]) : spacing([2.5, 4])};
|
|
126
135
|
pointer-events: auto;
|
|
127
136
|
transition: all 0.2s ease-in-out, background-color 0.2s ease-in-out;
|
|
128
137
|
&.disabled {
|
|
@@ -169,45 +178,48 @@ const ButtonIconCSS = css`
|
|
|
169
178
|
${borderBox};
|
|
170
179
|
max-height: 24px;
|
|
171
180
|
max-width: 24px;
|
|
172
|
-
margin-right:
|
|
181
|
+
margin-right: ${spacing([1])};
|
|
173
182
|
&.end-icon {
|
|
174
183
|
margin-right: unset;
|
|
175
|
-
margin-left:
|
|
184
|
+
margin-left: ${spacing([1])};
|
|
176
185
|
}
|
|
177
186
|
`;
|
|
178
187
|
TabItem.defaultProps = {
|
|
188
|
+
className: '',
|
|
179
189
|
disabled: false,
|
|
180
190
|
label: '',
|
|
181
|
-
className: '',
|
|
182
191
|
style: {}
|
|
183
192
|
};
|
|
184
193
|
TabItem.propTypes = {
|
|
194
|
+
/** Element to display in Tabs (like label). */
|
|
195
|
+
children: PropTypes.node,
|
|
196
|
+
|
|
197
|
+
/** Class for component. */
|
|
198
|
+
className: PropTypes.string,
|
|
199
|
+
|
|
185
200
|
/** Color for Tabs. */
|
|
186
201
|
color: PropTypes.string,
|
|
187
202
|
|
|
188
203
|
/** If true, the component is disabled. */
|
|
189
204
|
disabled: PropTypes.bool,
|
|
190
205
|
|
|
206
|
+
/** Icon to the right of the button. */
|
|
207
|
+
endIcon: PropTypes.node,
|
|
208
|
+
|
|
191
209
|
/** Index received in position of TabHeaderButton. */
|
|
192
210
|
index: PropTypes.number,
|
|
193
211
|
|
|
194
212
|
/** Data string, if any. */
|
|
195
213
|
label: PropTypes.string,
|
|
196
214
|
|
|
197
|
-
/**
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
/** Icon to the left of the button. */
|
|
201
|
-
startIcon: PropTypes.node,
|
|
202
|
-
|
|
203
|
-
/** Icon to the right of the button. */
|
|
204
|
-
endIcon: PropTypes.node,
|
|
215
|
+
/** [Props](https://core.diginet.com.vn/ui/?path=/docs/typography--title) applied to the `Typography` label. */
|
|
216
|
+
labelProps: PropTypes.object,
|
|
205
217
|
|
|
206
218
|
/** Callback fired when a "click" event is detected. */
|
|
207
219
|
onClick: PropTypes.func,
|
|
208
220
|
|
|
209
|
-
/**
|
|
210
|
-
|
|
221
|
+
/** Icon to the left of the button. */
|
|
222
|
+
startIcon: PropTypes.node,
|
|
211
223
|
|
|
212
224
|
/** Style inline of component. */
|
|
213
225
|
style: PropTypes.object,
|
|
@@ -218,8 +230,6 @@ TabItem.propTypes = {
|
|
|
218
230
|
/**
|
|
219
231
|
* Ref methods.
|
|
220
232
|
*/
|
|
221
|
-
reference:
|
|
222
|
-
current: PropTypes.instanceOf(Element)
|
|
223
|
-
})])
|
|
233
|
+
reference: ref
|
|
224
234
|
};
|
|
225
235
|
export default TabItem;
|