diginet-core-ui 1.3.50 → 1.3.51
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/css.js +27 -30
- package/components/accordion/details.js +17 -15
- package/components/accordion/group.js +10 -10
- package/components/accordion/index.js +25 -21
- package/components/accordion/summary.js +28 -37
- package/components/form-control/input-base/index.js +33 -25
- package/components/tree-view/css.js +1 -0
- package/package.json +2 -5
- package/readme.md +5 -0
- package/styles/general.js +1 -1
- package/theme/make-styles.js +19 -2
- package/theme/theme-provider.js +2 -1
- package/utils/useDelayUnmount.js +19 -0
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { css } from '@emotion/core';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { alignCenter, backgroundTransparent, borderBox, borderRadius4px, breakWord, cursorPointer, displayInlineBlock, flexRow, flexRowReverse, inlineFlex, justifyBetween, justifyCenter, justifyEnd, pointerEventsNone, positionAbsolute, positionRelative, userSelectNone } from '../../styles/general';
|
|
2
|
+
import theme from '../../theme/settings';
|
|
3
|
+
import { alignCenter, alignStart, backgroundTransparent, borderBox, borderRadius4px, breakWord, cursorPointer, displayInlineBlock, flexRow, flexRowReverse, inlineFlex, justifyBetween, justifyCenter, justifyEnd, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, userSelectNone } from '../../styles/general';
|
|
5
4
|
const {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
colors: {
|
|
6
|
+
system: {
|
|
7
|
+
active,
|
|
8
|
+
disabled: systemDisabled
|
|
9
|
+
},
|
|
10
|
+
fill: {
|
|
11
|
+
disabled: fillDisabled,
|
|
12
|
+
headerbar,
|
|
13
|
+
focus,
|
|
14
|
+
hover,
|
|
15
|
+
pressed
|
|
16
|
+
}
|
|
12
17
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
} = colors;
|
|
21
|
-
export const SummaryRootCSS = css`
|
|
18
|
+
typography: {
|
|
19
|
+
heading3
|
|
20
|
+
},
|
|
21
|
+
spacing
|
|
22
|
+
} = theme;
|
|
23
|
+
export const SummaryRootCSS = background => css`
|
|
22
24
|
${flexRow};
|
|
23
25
|
${positionRelative};
|
|
24
26
|
${justifyBetween};
|
|
25
|
-
${
|
|
27
|
+
${alignStart};
|
|
26
28
|
${cursorPointer};
|
|
27
29
|
${borderBox};
|
|
28
30
|
${borderRadius4px};
|
|
29
31
|
width: 100%;
|
|
30
32
|
min-height: 56px;
|
|
31
|
-
padding:
|
|
32
|
-
|
|
33
|
-
background-color: ${headerbar};
|
|
34
|
-
}
|
|
33
|
+
padding: ${spacing(4)}px ${spacing(6)}px;
|
|
34
|
+
${background && `background-color: ${background === true ? headerbar : theme.colors[background] || background};`};
|
|
35
35
|
.Accordion-Expand-Icon,
|
|
36
36
|
.Accordion-Collapse-Icon {
|
|
37
37
|
${cursorPointer};
|
|
@@ -47,8 +47,7 @@ export const SummaryRootCSS = css`
|
|
|
47
47
|
${flexRow};
|
|
48
48
|
.Accordion-Icon.rotate-able {
|
|
49
49
|
${borderBox};
|
|
50
|
-
|
|
51
|
-
height: 24px;
|
|
50
|
+
${parseWidthHeight(24, 24)};
|
|
52
51
|
&:not(.TreeView) {
|
|
53
52
|
transform: rotateZ(0deg);
|
|
54
53
|
transform-origin: center;
|
|
@@ -62,7 +61,7 @@ export const SummaryRootCSS = css`
|
|
|
62
61
|
${flexRowReverse};
|
|
63
62
|
${justifyEnd};
|
|
64
63
|
.Accordion-Icon.rotate-able {
|
|
65
|
-
margin-right:
|
|
64
|
+
margin-right: ${spacing(2)}px;
|
|
66
65
|
&.TreeView {
|
|
67
66
|
transform: rotateZ(-90deg);
|
|
68
67
|
}
|
|
@@ -70,7 +69,7 @@ export const SummaryRootCSS = css`
|
|
|
70
69
|
}
|
|
71
70
|
&.end {
|
|
72
71
|
.Accordion-Icon.rotate-able {
|
|
73
|
-
margin-left:
|
|
72
|
+
margin-left: ${spacing(2)}px;
|
|
74
73
|
&.TreeView {
|
|
75
74
|
transform: rotateZ(90deg);
|
|
76
75
|
}
|
|
@@ -144,8 +143,7 @@ export const SummaryRootCSS = css`
|
|
|
144
143
|
${displayInlineBlock};
|
|
145
144
|
${positionRelative};
|
|
146
145
|
${cursorPointer};
|
|
147
|
-
|
|
148
|
-
height: 24px;
|
|
146
|
+
${parseWidthHeight(24, 24)};
|
|
149
147
|
transition: transform 200ms linear;
|
|
150
148
|
.Accordion-Expand-Icon {
|
|
151
149
|
transform: scale(1);
|
|
@@ -169,7 +167,6 @@ export const SummaryRootCSS = css`
|
|
|
169
167
|
max-width: 34px;
|
|
170
168
|
min-height: 24px;
|
|
171
169
|
max-height: 34px;
|
|
172
|
-
padding: 3px;
|
|
173
170
|
}
|
|
174
171
|
}
|
|
175
172
|
`;
|
|
@@ -5,16 +5,18 @@ import { memo, forwardRef, useRef, useMemo, useImperativeHandle } from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import { borderBox, displayBlock, overflowHidden, pointerEventsNone, positionRelative, userSelectNone } from '../../styles/general';
|
|
8
|
-
import
|
|
9
|
-
import { color as colors } from '../../styles/colors';
|
|
8
|
+
import theme from '../../theme/settings';
|
|
10
9
|
const {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
colors: {
|
|
11
|
+
text: {
|
|
12
|
+
main
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
typography: {
|
|
16
|
+
paragraph1
|
|
17
|
+
},
|
|
18
|
+
spacing
|
|
19
|
+
} = theme;
|
|
18
20
|
const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
19
21
|
children,
|
|
20
22
|
className,
|
|
@@ -52,7 +54,7 @@ const DetailsRootCSS = css`
|
|
|
52
54
|
.DGN-UI-Accordion-Details-Content {
|
|
53
55
|
${borderBox};
|
|
54
56
|
${paragraph1};
|
|
55
|
-
padding: 0
|
|
57
|
+
padding: 0 ${spacing(6)}px ${spacing(4)}px ${spacing(6)}px;
|
|
56
58
|
color: ${main};
|
|
57
59
|
&.disabled {
|
|
58
60
|
${pointerEventsNone}
|
|
@@ -66,13 +68,13 @@ AccordionDetails.defaultProps = {
|
|
|
66
68
|
id: ''
|
|
67
69
|
};
|
|
68
70
|
AccordionDetails.propTypes = {
|
|
69
|
-
/** The
|
|
71
|
+
/** The content of the component. */
|
|
70
72
|
children: PropTypes.node,
|
|
71
73
|
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
+
/** Style inline of component. */
|
|
75
|
+
style: PropTypes.object,
|
|
74
76
|
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
+
/** Class for component. */
|
|
78
|
+
className: PropTypes.string
|
|
77
79
|
};
|
|
78
80
|
export default AccordionDetails;
|
|
@@ -41,10 +41,10 @@ const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
41
41
|
ref: ref,
|
|
42
42
|
style: style,
|
|
43
43
|
className: ['DGN-UI-Accordion-Group', className].join(' ').trim().replace(/\s+/g, ' ')
|
|
44
|
-
}, Children.map(children, child => /*#__PURE__*/cloneElement(child, {
|
|
44
|
+
}, Children.map(children, child => child && /*#__PURE__*/cloneElement(child, {
|
|
45
45
|
onExpand: e => onCollapseOther(e, child.props.onExpand)
|
|
46
46
|
})));
|
|
47
|
-
}, [className, children]);
|
|
47
|
+
}, [style, className, children]);
|
|
48
48
|
}));
|
|
49
49
|
const AccordionGroupRootCSS = css`
|
|
50
50
|
${borderRadius4px};
|
|
@@ -113,16 +113,16 @@ AccordionGroup.defaultProps = {
|
|
|
113
113
|
style: {}
|
|
114
114
|
};
|
|
115
115
|
AccordionGroup.propTypes = {
|
|
116
|
-
/**
|
|
117
|
-
|
|
116
|
+
/** The content of the component. */
|
|
117
|
+
children: PropTypes.node,
|
|
118
118
|
|
|
119
|
-
/**
|
|
120
|
-
|
|
119
|
+
/** Style inline of component. */
|
|
120
|
+
style: PropTypes.object,
|
|
121
121
|
|
|
122
|
-
/**
|
|
123
|
-
|
|
122
|
+
/** Class for component. */
|
|
123
|
+
className: PropTypes.string,
|
|
124
124
|
|
|
125
|
-
/**
|
|
126
|
-
|
|
125
|
+
/** If `true`, collapse other when expand */
|
|
126
|
+
collapseOther: PropTypes.bool
|
|
127
127
|
};
|
|
128
128
|
export default AccordionGroup;
|
|
@@ -7,13 +7,16 @@ import { jsx, css } from '@emotion/core';
|
|
|
7
7
|
import AccordionContext from './context';
|
|
8
8
|
import Divider from '../divider';
|
|
9
9
|
import { borderRadius4px, displayBlock, positionRelative } from '../../styles/general';
|
|
10
|
-
import
|
|
10
|
+
import theme from '../../theme/settings';
|
|
11
11
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
colors: {
|
|
13
|
+
line: {
|
|
14
|
+
category
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
|
-
} =
|
|
17
|
+
} = theme;
|
|
16
18
|
const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
19
|
+
id,
|
|
17
20
|
disabled,
|
|
18
21
|
expand,
|
|
19
22
|
expanded,
|
|
@@ -57,6 +60,7 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
57
60
|
});
|
|
58
61
|
return useMemo(() => {
|
|
59
62
|
return jsx("div", {
|
|
63
|
+
id: id,
|
|
60
64
|
css: AccordionRootCSS,
|
|
61
65
|
ref: ref,
|
|
62
66
|
style: style,
|
|
@@ -78,7 +82,7 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
78
82
|
display: 'none'
|
|
79
83
|
}
|
|
80
84
|
})));
|
|
81
|
-
}, [disabled, className, boxShadow, onClick, children, expanded, onExpand, onCollapse, expandState]);
|
|
85
|
+
}, [id, disabled, className, boxShadow, onClick, children, expanded, onExpand, onCollapse, expandState]);
|
|
82
86
|
}));
|
|
83
87
|
const AccordionRootCSS = css`
|
|
84
88
|
${displayBlock};
|
|
@@ -102,31 +106,31 @@ Accordion.defaultProps = {
|
|
|
102
106
|
style: {}
|
|
103
107
|
};
|
|
104
108
|
Accordion.propTypes = {
|
|
105
|
-
/**
|
|
109
|
+
/** The content of the component (insist <AccordionSummary />, <AccordionDetails />). */
|
|
110
|
+
children: PropTypes.node,
|
|
111
|
+
|
|
112
|
+
/** Style inline of component. */
|
|
113
|
+
style: PropTypes.object,
|
|
114
|
+
|
|
115
|
+
/** Class for component. */
|
|
116
|
+
className: PropTypes.string,
|
|
117
|
+
|
|
118
|
+
/** If `true`, the component is disabled. */
|
|
106
119
|
disabled: PropTypes.bool,
|
|
107
120
|
|
|
108
|
-
/** expand immediate after render
|
|
121
|
+
/** If `true`, expand immediate after render (shouldn't use this). */
|
|
109
122
|
expand: PropTypes.bool,
|
|
110
123
|
|
|
111
|
-
/**
|
|
124
|
+
/** Expand state of accordion (should use this). */
|
|
112
125
|
expanded: PropTypes.bool,
|
|
113
126
|
|
|
114
|
-
/**
|
|
115
|
-
className: PropTypes.string,
|
|
116
|
-
|
|
117
|
-
/** class on element */
|
|
127
|
+
/** The box-shadow of component. */
|
|
118
128
|
boxShadow: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
119
129
|
|
|
120
|
-
/**
|
|
130
|
+
/** Callback fired when Accordion is expanded. */
|
|
121
131
|
onExpand: PropTypes.func,
|
|
122
132
|
|
|
123
|
-
/**
|
|
124
|
-
onCollapse: PropTypes.func
|
|
125
|
-
|
|
126
|
-
/** insist <AccordionSummary />, <AccordionDetails /> */
|
|
127
|
-
children: PropTypes.node,
|
|
128
|
-
|
|
129
|
-
/** style inline of component */
|
|
130
|
-
style: PropTypes.object
|
|
133
|
+
/** Callback fired when Accordion is collapsed. */
|
|
134
|
+
onCollapse: PropTypes.func
|
|
131
135
|
};
|
|
132
136
|
export default Accordion;
|
|
@@ -8,6 +8,7 @@ import { renderIcon } from '../../utils';
|
|
|
8
8
|
import { SummaryRootCSS } from './css';
|
|
9
9
|
import AccordionContext from './context';
|
|
10
10
|
const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
|
+
id,
|
|
11
12
|
expandIcon,
|
|
12
13
|
collapseIcon,
|
|
13
14
|
expandIconAt,
|
|
@@ -18,9 +19,6 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
18
19
|
expandIconProps,
|
|
19
20
|
style
|
|
20
21
|
}, reference) => {
|
|
21
|
-
const ref = useRef(null);
|
|
22
|
-
const expandIconRef = useRef(null);
|
|
23
|
-
const timer = useRef(null);
|
|
24
22
|
const {
|
|
25
23
|
expanded,
|
|
26
24
|
expandState,
|
|
@@ -30,8 +28,13 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
30
28
|
onCollapse,
|
|
31
29
|
setExpandState
|
|
32
30
|
} = useContext(AccordionContext);
|
|
31
|
+
const ref = useRef(null);
|
|
32
|
+
const expandIconRef = useRef(null);
|
|
33
|
+
const timer = useRef(null);
|
|
33
34
|
|
|
34
|
-
const
|
|
35
|
+
const _SummaryRootCSS = SummaryRootCSS(background);
|
|
36
|
+
|
|
37
|
+
const _onClick = e => {
|
|
35
38
|
if (!disabled) {
|
|
36
39
|
const target = e.target;
|
|
37
40
|
|
|
@@ -93,19 +96,6 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
93
96
|
}
|
|
94
97
|
};
|
|
95
98
|
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
if (/^(#|rgb)/.test(background)) {
|
|
98
|
-
if (ref.current) {
|
|
99
|
-
ref.current.style.backgroundColor = background;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return () => {
|
|
103
|
-
if (ref.current) {
|
|
104
|
-
ref.current.style.backgroundColor = null;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}, [background]);
|
|
109
99
|
useEffect(() => {
|
|
110
100
|
if (expandState) {
|
|
111
101
|
showHideDetailHandler('show');
|
|
@@ -124,19 +114,20 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
124
114
|
});
|
|
125
115
|
return useMemo(() => {
|
|
126
116
|
return jsx("div", {
|
|
127
|
-
|
|
117
|
+
id: id,
|
|
118
|
+
css: _SummaryRootCSS,
|
|
128
119
|
ref: ref,
|
|
129
120
|
tabIndex: "-1",
|
|
130
|
-
onClick:
|
|
121
|
+
onClick: _onClick,
|
|
131
122
|
style: style,
|
|
132
|
-
className: ['DGN-UI-Accordion-Summary', disabled ? 'disabled' : '', expandIcon ? expandIconAt : '',
|
|
123
|
+
className: ['DGN-UI-Accordion-Summary', disabled ? 'disabled' : '', expandIcon ? expandIconAt : '', expandState ? 'expanding' : '', className].join(' ').trim().replace(/\s+/g, ' ')
|
|
133
124
|
}, jsx("div", {
|
|
134
125
|
className: 'DGN-UI-Accordion-Summary-Content'
|
|
135
126
|
}, children), !!expandIcon && jsx("div", {
|
|
136
127
|
className: 'Accordion-Icon-Root'
|
|
137
128
|
}, jsx("div", { ...expandIconProps,
|
|
138
129
|
ref: expandIconRef,
|
|
139
|
-
className: ['Accordion-Icon', collapseIcon ? '' : 'rotate-able', expandIconProps.className ? expandIconProps.className : ''].join(' ').trim()
|
|
130
|
+
className: ['Accordion-Icon', collapseIcon ? '' : 'rotate-able', expandIconProps.className ? expandIconProps.className : ''].join(' ').trim().replace(/\s+/g, ' ')
|
|
140
131
|
}, typeof expandIcon === 'string' ? renderIcon(expandIcon, 'effect', {
|
|
141
132
|
className: 'Accordion-Expand-Icon'
|
|
142
133
|
}) : jsx("span", {
|
|
@@ -146,7 +137,7 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
146
137
|
}) : jsx("span", {
|
|
147
138
|
className: 'Accordion-Collapse-Icon effect'
|
|
148
139
|
}, collapseIcon)))));
|
|
149
|
-
}, [expandIcon, expandIconAt, className, background, children, collapseIcon, expandIconProps, expandState]);
|
|
140
|
+
}, [id, expandIcon, expandIconAt, className, background, children, collapseIcon, expandIconProps, expandState]);
|
|
150
141
|
}));
|
|
151
142
|
AccordionSummary.defaultProps = {
|
|
152
143
|
expandIconAt: 'start',
|
|
@@ -156,28 +147,28 @@ AccordionSummary.defaultProps = {
|
|
|
156
147
|
style: {}
|
|
157
148
|
};
|
|
158
149
|
AccordionSummary.propTypes = {
|
|
159
|
-
/**
|
|
150
|
+
/** The content of the component. */
|
|
151
|
+
children: PropTypes.node,
|
|
152
|
+
|
|
153
|
+
/** Style inline of component. */
|
|
154
|
+
style: PropTypes.object,
|
|
155
|
+
|
|
156
|
+
/** Class for component. */
|
|
157
|
+
className: PropTypes.string,
|
|
158
|
+
|
|
159
|
+
/** Icon display for expand icon. */
|
|
160
160
|
expandIcon: PropTypes.any,
|
|
161
161
|
|
|
162
|
-
/**
|
|
162
|
+
/** Icon display for collapse icon. */
|
|
163
163
|
collapseIcon: PropTypes.any,
|
|
164
164
|
|
|
165
|
-
/**
|
|
165
|
+
/** Position to render icon. */
|
|
166
166
|
expandIconAt: PropTypes.oneOf(['start', 'end']),
|
|
167
167
|
|
|
168
|
-
/**
|
|
168
|
+
/** Background for label summary. */
|
|
169
169
|
background: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
170
170
|
|
|
171
|
-
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
/** The element to display in alert like text props (priority) */
|
|
175
|
-
children: PropTypes.node,
|
|
176
|
-
|
|
177
|
-
/** props of expand and collapse icons */
|
|
178
|
-
expandIconProps: PropTypes.any,
|
|
179
|
-
|
|
180
|
-
/** style inline of component */
|
|
181
|
-
style: PropTypes.object
|
|
171
|
+
/** Other props of icons. */
|
|
172
|
+
expandIconProps: PropTypes.any
|
|
182
173
|
};
|
|
183
174
|
export default AccordionSummary;
|
|
@@ -86,7 +86,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
86
86
|
padding-top: 4px;
|
|
87
87
|
&:not(:focus-within):hover {
|
|
88
88
|
&::before {
|
|
89
|
-
border-bottom-color: ${colors.brand};
|
|
89
|
+
${!readOnly && `border-bottom-color: ${colors.brand}`};
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
&:focus-within {
|
|
@@ -125,11 +125,13 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
125
125
|
box-sizing: border-box;
|
|
126
126
|
background-color: ${colors.white};
|
|
127
127
|
&:not(:focus-within):hover {
|
|
128
|
-
|
|
129
|
-
border-color: ${colors.brand};
|
|
130
|
-
input {
|
|
128
|
+
${!readOnly && `
|
|
131
129
|
background-color: ${colors.hover};
|
|
132
|
-
|
|
130
|
+
border-color: ${colors.brand};
|
|
131
|
+
input {
|
|
132
|
+
background-color: ${colors.hover};
|
|
133
|
+
}
|
|
134
|
+
`};
|
|
133
135
|
}
|
|
134
136
|
&:focus-within {
|
|
135
137
|
${!readOnly && `
|
|
@@ -203,9 +205,9 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
203
205
|
&.outlined {
|
|
204
206
|
background-color: ${colors.dark12};
|
|
205
207
|
}
|
|
206
|
-
input {
|
|
208
|
+
/* input {
|
|
207
209
|
color: ${colors.disabled};
|
|
208
|
-
}
|
|
210
|
+
} */
|
|
209
211
|
.start-icon,
|
|
210
212
|
.end-icon {
|
|
211
213
|
&:not(.non-effect),
|
|
@@ -276,15 +278,17 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
276
278
|
position: relative;
|
|
277
279
|
resize: ${resize};
|
|
278
280
|
box-sizing: border-box;
|
|
279
|
-
&:disabled {
|
|
281
|
+
/* &:disabled {
|
|
280
282
|
color: ${colors.disabled};
|
|
281
|
-
}
|
|
283
|
+
} */
|
|
282
284
|
&:hover:not(:focus-within) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
::placeholder {
|
|
285
|
+
${!readOnly && `
|
|
286
|
+
border-color: ${colors.brand};
|
|
286
287
|
color: ${colors.primary};
|
|
287
|
-
|
|
288
|
+
::placeholder {
|
|
289
|
+
color: ${colors.primary};
|
|
290
|
+
}
|
|
291
|
+
`};
|
|
288
292
|
}
|
|
289
293
|
&:focus-within {
|
|
290
294
|
color: ${colors.primary};
|
|
@@ -316,11 +320,13 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
316
320
|
height: 24px;
|
|
317
321
|
}
|
|
318
322
|
&:not(:focus-within):hover {
|
|
319
|
-
|
|
320
|
-
border-color: ${colors.brand};
|
|
321
|
-
input {
|
|
323
|
+
${!readOnly && `
|
|
322
324
|
background-color: ${colors.hover};
|
|
323
|
-
|
|
325
|
+
border-color: ${colors.brand};
|
|
326
|
+
input {
|
|
327
|
+
background-color: ${colors.hover};
|
|
328
|
+
}
|
|
329
|
+
`};
|
|
324
330
|
}
|
|
325
331
|
&:focus-within {
|
|
326
332
|
${!readOnly && `
|
|
@@ -351,17 +357,19 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
351
357
|
height: 24px;
|
|
352
358
|
}
|
|
353
359
|
&:not(:focus-within):hover {
|
|
354
|
-
|
|
360
|
+
${!readOnly && `
|
|
361
|
+
&::before {
|
|
355
362
|
border-bottom-color: ${colors.brand};
|
|
356
|
-
|
|
363
|
+
}
|
|
364
|
+
`};
|
|
357
365
|
}
|
|
358
366
|
&:focus-within {
|
|
359
367
|
${!readOnly && `
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
368
|
+
&::after {
|
|
369
|
+
border-bottom-color: ${colors.info5};
|
|
370
|
+
transform: scaleX(1);
|
|
371
|
+
}
|
|
372
|
+
`}
|
|
365
373
|
}
|
|
366
374
|
&::before {
|
|
367
375
|
content: '';
|
|
@@ -386,7 +394,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
386
394
|
&.disabled {
|
|
387
395
|
pointer-events: none;
|
|
388
396
|
resize: none;
|
|
389
|
-
color: ${colors.disabled};
|
|
397
|
+
/* color: ${colors.disabled}; */
|
|
390
398
|
&.outlined {
|
|
391
399
|
background-color: ${colors.dark12};
|
|
392
400
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "diginet-core-ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.51",
|
|
4
4
|
"description": "The DigiNet core ui",
|
|
5
5
|
"homepage": "https://diginet.com.vn",
|
|
6
6
|
"main": "index.js",
|
|
@@ -13,10 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@emotion/core": "^10.0.35",
|
|
16
|
-
"
|
|
17
|
-
"prop-types": "^15.7.2",
|
|
18
|
-
"react": "^16.12.0",
|
|
19
|
-
"react-dom": "^16.12.0"
|
|
16
|
+
"prop-types": "^15.7.2"
|
|
20
17
|
},
|
|
21
18
|
"repository": {
|
|
22
19
|
"type": "git",
|
package/readme.md
CHANGED
|
@@ -38,6 +38,11 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.51
|
|
42
|
+
- \[Fixed\]: THEME – Fix bug makeStyles add duplicate style tag into head tag
|
|
43
|
+
- \[Fixed\]: Accordion – Change css AccordionSummary; Fix when children of AccordionGroup null
|
|
44
|
+
- \[Fixed\]: InputBase – Fix disabled css
|
|
45
|
+
|
|
41
46
|
## 1.3.50
|
|
42
47
|
- \[Fixed\]: Dropdown – Fix dropdown onInput search
|
|
43
48
|
|
package/styles/general.js
CHANGED
|
@@ -177,7 +177,7 @@ export const parseWidth = width => css`
|
|
|
177
177
|
export const parseHeight = height => css`
|
|
178
178
|
height: ${isNaN(height) ? height : height + 'px'};
|
|
179
179
|
`;
|
|
180
|
-
export const parseWidthHeight = (width, height) => css`
|
|
180
|
+
export const parseWidthHeight = (width, height = width) => css`
|
|
181
181
|
width: ${isNaN(width) ? width : width + 'px'};
|
|
182
182
|
height: ${isNaN(height) ? height : height + 'px'};
|
|
183
183
|
`;
|
package/theme/make-styles.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { css } from '@emotion/core';
|
|
2
2
|
import theme from './settings';
|
|
3
|
-
|
|
3
|
+
let makeStylesEls = [];
|
|
4
|
+
|
|
5
|
+
const setMakeStylesEls = value => {
|
|
6
|
+
makeStylesEls = value;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { makeStylesEls, setMakeStylesEls };
|
|
4
10
|
|
|
5
11
|
const makeStyle = obj => {
|
|
6
12
|
if (typeof obj === 'function') {
|
|
@@ -65,11 +71,14 @@ const separateStyle = (className, style) => {
|
|
|
65
71
|
};
|
|
66
72
|
|
|
67
73
|
const createStyle = (className, style) => {
|
|
74
|
+
const styleInnerHTML = `${/@media/.test(className) ? '' : '.'}${className} {${style}}`; // Nếu đã có style trong head thì không thêm vào nữa
|
|
75
|
+
|
|
76
|
+
if (checkExist(styleInnerHTML)) return;
|
|
68
77
|
const styleEl = document.createElement('style');
|
|
69
78
|
styleEl.type = 'text/css';
|
|
70
79
|
styleEl.dataMeta = 'makeStyles';
|
|
71
80
|
document.head.appendChild(styleEl);
|
|
72
|
-
styleEl.appendChild(document.createTextNode(
|
|
81
|
+
styleEl.appendChild(document.createTextNode(styleInnerHTML));
|
|
73
82
|
makeStylesEls.push(styleEl);
|
|
74
83
|
};
|
|
75
84
|
|
|
@@ -92,4 +101,12 @@ const getEndBraces = (str, start) => {
|
|
|
92
101
|
return temp;
|
|
93
102
|
};
|
|
94
103
|
|
|
104
|
+
const checkExist = styleInnerHTML => {
|
|
105
|
+
let isExist = false;
|
|
106
|
+
makeStylesEls.some(el => {
|
|
107
|
+
if (el.innerHTML === styleInnerHTML) isExist = true;
|
|
108
|
+
});
|
|
109
|
+
return isExist;
|
|
110
|
+
};
|
|
111
|
+
|
|
95
112
|
export default makeStyle;
|
package/theme/theme-provider.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { memo, useEffect } from 'react';
|
|
5
5
|
import { jsx, css } from '@emotion/core';
|
|
6
6
|
import { setTheme } from './set-theme';
|
|
7
|
-
import { makeStylesEls } from './make-styles';
|
|
7
|
+
import { makeStylesEls, setMakeStylesEls } from './make-styles';
|
|
8
8
|
import { string, object, node } from 'prop-types';
|
|
9
9
|
import { font } from '../styles/font';
|
|
10
10
|
const {
|
|
@@ -50,6 +50,7 @@ const ThemeProvider = /*#__PURE__*/memo(({
|
|
|
50
50
|
children
|
|
51
51
|
}) => {
|
|
52
52
|
useEffect(() => {
|
|
53
|
+
setMakeStylesEls([]);
|
|
53
54
|
return () => {
|
|
54
55
|
if (makeStylesEls.length) {
|
|
55
56
|
makeStylesEls.forEach(el => el && el.remove && el.remove());
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useDelayUnmount = (isMounted, delayTime) => {
|
|
4
|
+
const [show, setShow] = useState(false);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
let timeoutId;
|
|
7
|
+
|
|
8
|
+
if (isMounted && !show) {
|
|
9
|
+
setShow(true);
|
|
10
|
+
} else if (!isMounted && show) {
|
|
11
|
+
timeoutId = setTimeout(() => setShow(false), delayTime);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return () => clearTimeout(timeoutId);
|
|
15
|
+
}, [isMounted, delayTime, show]);
|
|
16
|
+
return show;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default useDelayUnmount;
|