diginet-core-ui 1.3.43-beta.5 → 1.3.44-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/images/menu/dhr/MHRP09N0033.svg +12 -0
- package/components/form-control/helper-text/index.js +35 -33
- package/components/form-control/number-input/index2.js +7 -7
- package/components/form-control/time-picker/index.js +10 -19
- package/package.json +1 -1
- package/readme.md +12 -0
- package/theme/make-styles.js +12 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M34.66 9.48L25.43 0.34C25.22 0.12 24.92 0 24.62 0H8.46C6.55 0 5 1.54 5 3.43V35.57C5 37.46 6.55 39 8.46 39H10.31H29.68H31.53C33.44 39 34.99 37.46 34.99 35.57V18.04V16.98V11.42V11.31V10.28C35 9.97 34.87 9.68 34.66 9.48ZM25.77 3.9L31.06 9.14H26.92C26.28 9.14 25.77 8.63 25.77 8V3.9ZM32.69 18.13V35.58C32.69 36.21 32.17 36.72 31.54 36.72H26.38H13.62H8.46C7.82 36.72 7.31 36.21 7.31 35.58V3.43C7.31 2.8 7.83 2.29 8.46 2.29H23.46V8C23.46 9.89 25.01 11.43 26.92 11.43H31.04C31.05 11.43 31.06 11.43 31.07 11.43H32.69V16.99V18.13V18.13Z" fill="#2680EB"/>
|
|
3
|
+
<path d="M30.79 28.13C30.79 27.5 30.27 26.99 29.64 26.99H19.23C18.59 26.99 18.08 27.5 18.08 28.13C18.08 28.76 18.6 29.27 19.23 29.27H29.64C30.27 29.27 30.79 28.76 30.79 28.13Z" fill="#FF8C00"/>
|
|
4
|
+
<path d="M29.64 22.41H19.23C18.59 22.41 18.08 22.92 18.08 23.55C18.08 24.18 18.6 24.69 19.23 24.69H29.64C30.28 24.69 30.79 24.18 30.79 23.55C30.79 22.92 30.27 22.41 29.64 22.41Z" fill="#FF8C00"/>
|
|
5
|
+
<path d="M19.23 31.56C18.59 31.56 18.08 32.07 18.08 32.7C18.08 33.33 18.6 33.84 19.23 33.84H25.02C25.66 33.84 26.17 33.33 26.17 32.7C26.17 32.07 25.65 31.56 25.02 31.56H19.23Z" fill="#FF8C00"/>
|
|
6
|
+
<path d="M10.0601 25.8101H11.2001V23.5701H10.2401V22.8501C10.8601 22.7501 11.1701 22.6401 11.5201 22.4301H12.3901V25.8201H13.3301V26.7601H10.0601V25.8101Z" fill="#FF8C00"/>
|
|
7
|
+
<path d="M14.8801 25.9401C14.8801 25.4501 15.2401 25.0501 15.7801 25.0501C16.3201 25.0501 16.6801 25.4501 16.6801 25.9401C16.6801 26.4301 16.3201 26.8301 15.7801 26.8301C15.2401 26.8301 14.8801 26.4301 14.8801 25.9401Z" fill="#FF8C00"/>
|
|
8
|
+
<path d="M9.91999 33.17C11.09 32.23 11.94 31.5 11.94 30.91C11.94 30.52 11.69 30.34 11.3 30.34C10.98 30.34 10.72 30.55 10.49 30.75L9.85999 30.12C10.34 29.64 10.78 29.42 11.47 29.42C12.41 29.42 13.06 29.98 13.06 30.84C13.06 31.54 12.33 32.3 11.61 32.9C11.85 32.87 12.18 32.85 12.4 32.85H13.28V33.83H9.91999V33.17Z" fill="#FF8C00"/>
|
|
9
|
+
<path d="M14.88 33.03C14.88 32.54 15.24 32.14 15.78 32.14C16.32 32.14 16.68 32.54 16.68 33.03C16.68 33.52 16.32 33.92 15.78 33.92C15.24 33.92 14.88 33.53 14.88 33.03Z" fill="#FF8C00"/>
|
|
10
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.83 6.84C21.71 6.72 21.55 6.65 21.38 6.65H18.64C18.72 6.49 18.76 6.31 18.76 6.13C18.76 5.51 18.26 5 17.65 5H17.64C17.15 5.03 16.68 5.22 16.3 5.54C15.95 5.81 15.63 6.1 15.33 6.41C15.02 6.1 14.7 5.81 14.35 5.54C13.97 5.22 13.5 5.03 13.01 5C12.39 5 11.89 5.5 11.89 6.13C11.89 6.31 11.93 6.49 12.01 6.65H9.27001C8.92001 6.65 8.64001 6.94 8.64001 7.29V8.54C8.64001 8.89 8.92001 9.18 9.27001 9.18H21.38C21.73 9.18 22.01 8.89 22.01 8.54V7.29C22.01 7.12 21.94 6.96 21.83 6.84ZM12.88 6.65C12.86 6.63 12.84 6.61 12.81 6.59C12.72 6.54 12.64 6.47 12.58 6.39C12.54 6.31 12.51 6.22 12.52 6.13C12.52 6 12.57 5.88 12.66 5.78C12.75 5.69 12.88 5.64 13 5.64C13.36 5.67 13.7 5.82 13.98 6.05C14.17 6.2 14.36 6.36 14.53 6.53C14.57 6.56 14.62 6.61 14.66 6.65H12.88ZM18.07 6.39C18.01 6.47 17.93 6.54 17.84 6.59C17.81 6.61 17.79 6.63 17.77 6.65H15.99L16.11 6.53C16.29 6.36 16.47 6.2 16.67 6.06C16.95 5.82 17.29 5.68 17.64 5.64C17.77 5.64 17.9 5.69 17.99 5.79C18.08 5.88 18.13 6 18.13 6.14C18.13 6.22 18.11 6.31 18.07 6.39Z" fill="#FFAA00"/>
|
|
11
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.82001 9.74V15.98C9.83001 16.54 10.27 17 10.82 17H19.83C20.09 17 20.35 16.89 20.53 16.7C20.72 16.51 20.83 16.25 20.83 15.98V9.74H9.82001ZM15.57 15.23V15.71C15.57 15.79 15.51 15.85 15.44 15.85H15.12C15.05 15.85 14.99 15.79 14.99 15.71V15.28C14.71 15.26 14.44 15.21 14.18 15.11C14.06 15.07 14 14.94 14.03 14.81L14.08 14.61C14.1 14.54 14.15 14.48 14.21 14.44C14.28 14.41 14.35 14.41 14.42 14.43C14.65 14.53 14.9 14.57 15.14 14.58C15.48 14.58 15.72 14.44 15.72 14.2C15.72 13.97 15.52 13.82 15.09 13.67C14.45 13.45 14.01 13.15 14.01 12.57C14.03 12 14.46 11.54 15.01 11.49V11.05C15.01 10.97 15.08 10.91 15.15 10.9H15.47C15.54 10.91 15.6 10.97 15.6 11.05V11.45C15.82 11.45 16.03 11.49 16.24 11.56C16.37 11.6 16.44 11.73 16.41 11.86L16.36 12.04C16.35 12.11 16.3 12.17 16.24 12.21C16.18 12.24 16.11 12.25 16.04 12.22C15.85 12.16 15.64 12.12 15.44 12.12C15.05 12.12 14.93 12.29 14.93 12.46C14.93 12.66 15.14 12.79 15.64 12.98C16.35 13.23 16.64 13.57 16.63 14.12C16.61 14.71 16.16 15.19 15.57 15.23Z" fill="#FFAA00"/>
|
|
12
|
+
</svg>
|
|
@@ -5,66 +5,68 @@ import { memo, forwardRef } from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import { Typography } from '../../';
|
|
8
|
-
import theme from '../../../theme/settings';
|
|
9
8
|
import { getGlobal } from '../../../global';
|
|
9
|
+
import theme from '../../../theme/settings';
|
|
10
|
+
const {
|
|
11
|
+
colors: {
|
|
12
|
+
system: {
|
|
13
|
+
disabled: systemDisabled
|
|
14
|
+
},
|
|
15
|
+
semantic: {
|
|
16
|
+
success,
|
|
17
|
+
warning,
|
|
18
|
+
danger,
|
|
19
|
+
info
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
spacing
|
|
23
|
+
} = theme;
|
|
24
|
+
const colorMap = new Map([['default', danger], ['success', success], ['warning', warning], ['danger', danger], ['info', info]]);
|
|
10
25
|
const HelperText = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
26
|
disabled,
|
|
12
27
|
status,
|
|
13
28
|
className,
|
|
29
|
+
style,
|
|
14
30
|
children,
|
|
15
|
-
|
|
31
|
+
id
|
|
16
32
|
}, ref) => {
|
|
17
|
-
|
|
18
|
-
const HelperTextRoot = css`
|
|
19
|
-
margin-top: 4px;
|
|
20
|
-
&.info {
|
|
21
|
-
color: ${theme.colors.info};
|
|
22
|
-
}
|
|
23
|
-
&.success {
|
|
24
|
-
color: ${theme.colors.success};
|
|
25
|
-
}
|
|
26
|
-
&.warning {
|
|
27
|
-
color: ${theme.colors.warning};
|
|
28
|
-
}
|
|
29
|
-
&.danger {
|
|
30
|
-
color: ${theme.colors.danger};
|
|
31
|
-
}
|
|
32
|
-
&.disabled {
|
|
33
|
-
color: ${theme.colors.disabled};
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
/* End styled */
|
|
37
|
-
|
|
33
|
+
const color = colorMap.get(status);
|
|
38
34
|
return jsx(Typography, {
|
|
39
35
|
ref: ref,
|
|
36
|
+
id: id,
|
|
40
37
|
type: 'p3',
|
|
41
|
-
color:
|
|
38
|
+
color: disabled ? systemDisabled : color,
|
|
42
39
|
fullWidth: false,
|
|
43
|
-
css:
|
|
44
|
-
className: ['DGN-UI-HelperText', className
|
|
45
|
-
|
|
40
|
+
css: HelperTextRootCSS,
|
|
41
|
+
className: ['DGN-UI-HelperText', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
42
|
+
style: style,
|
|
43
|
+
lineClamp: 1
|
|
46
44
|
}, typeof children === 'boolean' ? getGlobal('thisFieldIsRequired') : children);
|
|
47
45
|
}));
|
|
46
|
+
const HelperTextRootCSS = css`
|
|
47
|
+
margin-top: ${spacing()}px;
|
|
48
|
+
`;
|
|
48
49
|
HelperText.defaultProps = {
|
|
49
50
|
disabled: false,
|
|
50
51
|
status: 'default',
|
|
51
52
|
className: '',
|
|
53
|
+
style: {},
|
|
52
54
|
children: ''
|
|
53
55
|
};
|
|
54
56
|
HelperText.propTypes = {
|
|
55
|
-
/**
|
|
57
|
+
/** If true, the component is disabled. */
|
|
56
58
|
disabled: PropTypes.bool,
|
|
57
59
|
|
|
58
60
|
/** status type to display color for input (only available for type is inform) */
|
|
59
61
|
status: PropTypes.oneOf(['default', 'warning', 'success', 'danger', 'info']),
|
|
60
62
|
|
|
61
|
-
/**
|
|
63
|
+
/** Class for component. */
|
|
62
64
|
className: PropTypes.string,
|
|
63
65
|
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
+
/** Style inline of component. */
|
|
67
|
+
style: PropTypes.object,
|
|
66
68
|
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
+
/** Content to display in component. */
|
|
70
|
+
children: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
|
|
69
71
|
};
|
|
70
72
|
export default HelperText;
|
|
@@ -221,14 +221,14 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
221
221
|
e.preventDefault();
|
|
222
222
|
} // key arrow down
|
|
223
223
|
else if (keyCode === 40) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
224
|
+
_onInput({ ...e,
|
|
225
|
+
target: { ...e.target,
|
|
226
|
+
value: Number(convertMoneyToNumber(value) || 0) - step
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
229
|
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
e.preventDefault();
|
|
231
|
+
} // disabled negative
|
|
232
232
|
|
|
233
233
|
|
|
234
234
|
const disabled180 = (keyCode === 189 || keyCode === 109) && (disabledNegative || value.includes('-')); // Block event if include conditions
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { jsx, css } from '@emotion/core';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import React, { forwardRef, memo, useEffect,
|
|
6
|
+
import React, { forwardRef, memo, useEffect, useMemo, useRef } from 'react';
|
|
7
7
|
import { Cancel as CancelIcon, Clock as ClockIcon } from '../../../icons';
|
|
8
|
+
import HelperText from '../helper-text';
|
|
8
9
|
import { randomString, useOnClickOutside } from '../../../utils';
|
|
9
10
|
import theme from '../../../theme/settings';
|
|
10
11
|
import Swiper from './swiper';
|
|
@@ -432,21 +433,10 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
432
433
|
}
|
|
433
434
|
`
|
|
434
435
|
},
|
|
435
|
-
error:
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
margin-top: 8px;
|
|
440
|
-
pointer-events: none;
|
|
441
|
-
`,
|
|
442
|
-
underlined: css`
|
|
443
|
-
color: ${theme.colors.danger};
|
|
444
|
-
${typography.paragraph3};
|
|
445
|
-
bottom: -20px;
|
|
446
|
-
position: absolute;
|
|
447
|
-
pointer-events: none;
|
|
448
|
-
`
|
|
449
|
-
},
|
|
436
|
+
error: css`
|
|
437
|
+
position: absolute;
|
|
438
|
+
top: 100%;
|
|
439
|
+
`,
|
|
450
440
|
clock: {
|
|
451
441
|
container: css`
|
|
452
442
|
background-color: white;
|
|
@@ -762,9 +752,10 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
762
752
|
onChange: selected => setInputSecond(selected),
|
|
763
753
|
parentNode: swiperWrapperSecondsRef
|
|
764
754
|
})) : null), [activeHeight, activeWidth, allowSeconds, defaultValue, disabled, error, value, viewType]);
|
|
765
|
-
const ErrorMemo = useMemo(() => error && jsx(
|
|
766
|
-
css: styles.error
|
|
767
|
-
|
|
755
|
+
const ErrorMemo = useMemo(() => error && jsx(HelperText, {
|
|
756
|
+
css: styles.error,
|
|
757
|
+
disabled: disabled
|
|
758
|
+
}, error), [error, disabled]);
|
|
768
759
|
const MainMemo = useMemo(() => jsx("div", {
|
|
769
760
|
className: IDs.main,
|
|
770
761
|
css: styles.main[viewType],
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,6 +38,18 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.44
|
|
42
|
+
- \[Added\]: MenuIcon – MHRP09N0033
|
|
43
|
+
- \[Changed\]: Modal – Add prop className
|
|
44
|
+
- \[Changed\]: Slider – Update design button next, previous
|
|
45
|
+
- \[Changed\]: Settings – Return CORE typography in setting
|
|
46
|
+
- \[Changed\]: PagingInfo – Update design typeShort (Design update)
|
|
47
|
+
- \[Fixed\]: DatePicker – Fix bug clearable when readOnly, picker out of screen
|
|
48
|
+
- \[Fixed\]: DropdownBox – Fix bug press Tab close DropdownBox
|
|
49
|
+
- \[Fixed\]: ButtonIcon – Change element tag from button to div; Fix ripple effect circular
|
|
50
|
+
- \[Fixed\]: DatePicker – Fix bug warning proptype, keydown Tab not close DatePicker
|
|
51
|
+
- \[Fixed\]: InputBase – Fix css disabled
|
|
52
|
+
|
|
41
53
|
## 1.3.43
|
|
42
54
|
- \[Added\]: MenuIcon – MHRM00N0002, MHRM39N0018, MHRM39N0019, MHRM00N0003, MHRM00N0004 , MHRM13N0002, MHRM13N0003, MHRM29N0004
|
|
43
55
|
- \[Changed\]: Checkbox - Add labelProps
|
package/theme/make-styles.js
CHANGED
|
@@ -65,11 +65,14 @@ const separateStyle = (className, style) => {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
const createStyle = (className, style) => {
|
|
68
|
+
const styleInnerHTML = `${/@media/.test(className) ? '' : '.'}${className} {${style}}`; // Nếu đã có style trong head thì không thêm vào nữa
|
|
69
|
+
|
|
70
|
+
if (checkExist(styleInnerHTML)) return;
|
|
68
71
|
const styleEl = document.createElement('style');
|
|
69
72
|
styleEl.type = 'text/css';
|
|
70
73
|
styleEl.dataMeta = 'makeStyles';
|
|
71
74
|
document.head.appendChild(styleEl);
|
|
72
|
-
styleEl.appendChild(document.createTextNode(
|
|
75
|
+
styleEl.appendChild(document.createTextNode(styleInnerHTML));
|
|
73
76
|
makeStylesEls.push(styleEl);
|
|
74
77
|
};
|
|
75
78
|
|
|
@@ -92,4 +95,12 @@ const getEndBraces = (str, start) => {
|
|
|
92
95
|
return temp;
|
|
93
96
|
};
|
|
94
97
|
|
|
98
|
+
const checkExist = styleInnerHTML => {
|
|
99
|
+
let isExist = false;
|
|
100
|
+
makeStylesEls.some(el => {
|
|
101
|
+
if (el.innerHTML === styleInnerHTML) isExist = true;
|
|
102
|
+
});
|
|
103
|
+
return isExist;
|
|
104
|
+
};
|
|
105
|
+
|
|
95
106
|
export default makeStyle;
|