diginet-core-ui 1.3.24 → 1.3.29
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/fonts/SF-Pro-Display-Bold.otf +0 -0
- package/assets/fonts/SF-Pro-Display-Medium.otf +0 -0
- package/assets/fonts/SF-Pro-Display-Regular.otf +0 -0
- package/assets/images/icons/wifi.svg +3 -0
- package/assets/images/menu/dhr/MHRM09N0004.svg +14 -0
- package/assets/images/menu/dhr/MHRP09N0028.svg +6 -0
- package/assets/images/menu/dhr/MHRP09N0029.svg +14 -0
- package/assets/images/menu/dhr/MHRP09N0030.svg +4 -0
- package/assets/images/menu/dhr/MHRP09N0031.svg +5 -0
- package/assets/images/menu/dhr/MHRP29N0012.svg +7 -0
- package/assets/images/menu/dhr/MHRP29N0021.svg +8 -0
- package/assets/images/menu/dhr/MHRP29N0022.svg +9 -0
- package/assets/images/menu/dhr/MHRP29N0023.svg +22 -0
- package/assets/images/menu/dhr/MHRP39N0015.svg +5 -0
- package/assets/images/menu/dhr/TASK.svg +9 -0
- package/assets/images/menu/erp/D05.svg +8 -0
- package/assets/images/menu/erp/D06.svg +4 -0
- package/assets/images/menu/erp/D90R.svg +9 -0
- package/assets/images/menu/erp/DBC.svg +9 -0
- package/assets/images/menu/erp/{W05F0006.svg → W05F0006N0000.svg} +0 -0
- package/assets/images/menu/erp/{W05F0008.svg → W05F0008N0000.svg} +0 -0
- package/assets/images/menu/erp/{W05F4000.svg → W05F4000N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0005.svg → W06F0005N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0006.svg → W06F0006N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0008.svg → W06F0008N0000.svg} +0 -0
- package/assets/images/menu/erp/W94F1000N0000.svg +9 -0
- package/assets/images/menu/erp/W94F1000N0001.svg +9 -0
- package/components/accordion/css.js +42 -33
- package/components/accordion/details.js +29 -17
- package/components/accordion/group.js +23 -23
- package/components/accordion/index.js +36 -27
- package/components/accordion/summary.js +10 -11
- package/components/alert/index.js +97 -91
- package/components/alert/notify.js +10 -8
- package/components/avatar/index.js +19 -17
- package/components/badge/index.js +122 -139
- package/components/button/icon.js +242 -334
- package/components/button/index.js +272 -427
- package/components/button/more.js +4 -5
- package/components/button/ripple-effect.js +4 -6
- package/components/card/body-card.js +4 -6
- package/components/card/card.js +4 -8
- package/components/card/index.js +4 -5
- package/components/chart/Pie/Sector.js +4 -5
- package/components/chart/Pie/Sectors.js +5 -5
- package/components/chart/Pie/index.js +8 -9
- package/components/chart/Pie-v2/Sector.js +4 -5
- package/components/chart/Pie-v2/Sectors.js +7 -8
- package/components/chart/Pie-v2/index.js +11 -16
- package/components/chart/bar/Bar.js +2 -3
- package/components/chart/bar/Labels.js +9 -11
- package/components/chart/bar/index.js +17 -9
- package/components/chart/bar-v2/Bar.js +2 -3
- package/components/chart/bar-v2/Labels.js +9 -11
- package/components/chart/bar-v2/index.js +17 -9
- package/components/chart/line/Labels.js +8 -10
- package/components/chart/line/Point.js +2 -3
- package/components/chart/line/index.js +17 -9
- package/components/chart/line-v2/Labels.js +8 -10
- package/components/chart/line-v2/Point.js +2 -3
- package/components/chart/line-v2/index.js +17 -9
- package/components/chip/attach.js +12 -16
- package/components/chip/index.js +8 -11
- package/components/collapse/index.js +4 -5
- package/components/divider/index.js +27 -14
- package/components/form-control/attachment/index.js +143 -87
- package/components/form-control/calendar/function.js +24 -23
- package/components/form-control/calendar/index.js +2 -4
- package/components/form-control/calendar/range.js +3 -4
- package/components/form-control/checkbox/index.js +85 -71
- package/components/form-control/control/index.js +4 -6
- package/components/form-control/date-picker/index-old.js +0 -2
- package/components/form-control/date-picker/index.js +39 -43
- package/components/form-control/date-range-picker/index.js +26 -28
- package/components/form-control/dropdown/index.js +173 -202
- package/components/form-control/dropdown-box/index.js +72 -49
- package/components/form-control/form-group/index.js +4 -5
- package/components/form-control/helper-text/index.js +4 -5
- package/components/form-control/input-base/index.js +28 -38
- package/components/form-control/label/index.js +23 -13
- package/components/form-control/money-input/index.js +6 -6
- package/components/form-control/number-input/index.js +12 -14
- package/components/form-control/phone-input/index.js +4 -5
- package/components/form-control/radio/index.js +7 -15
- package/components/form-control/text-input/index.js +14 -24
- package/components/form-control/time-picker/index.js +15 -26
- package/components/form-control/time-picker/swiper.js +2 -4
- package/components/form-control/toggle/index.js +22 -18
- package/components/form-view/helper-text.js +4 -5
- package/components/form-view/index.js +4 -5
- package/components/form-view/input.js +5 -7
- package/components/form-view/label.js +2 -6
- package/components/list/list-item-action.js +7 -8
- package/components/list/list-item-icon.js +4 -5
- package/components/list/list-item-text.js +4 -5
- package/components/list/list-item.js +4 -5
- package/components/list/list.js +4 -5
- package/components/list/sub-header.js +4 -5
- package/components/modal/body.js +4 -6
- package/components/modal/footer.js +4 -6
- package/components/modal/header.js +8 -14
- package/components/modal/index.js +4 -5
- package/components/modal/modal.js +6 -13
- package/components/others/extra/index.js +4 -8
- package/components/others/option-wrapper/index.js +57 -0
- package/components/others/scrollbar/index.js +4 -5
- package/components/paging/page-info.js +282 -231
- package/components/paging/page-selector.js +4 -7
- package/components/popover/index.js +6 -7
- package/components/popup/danger_popup.js +8 -18
- package/components/popup/index.js +26 -34
- package/components/popup/proposals_popup.js +9 -16
- package/components/popup/v2/danger-popup.js +4 -6
- package/components/popup/v2/index.js +116 -98
- package/components/popup/v2/info-popup.js +4 -6
- package/components/popup/v2/success-popup.js +4 -6
- package/components/popup/v2/warning-popup.js +4 -6
- package/components/popup/v2/yes-no-popup.js +4 -6
- package/components/progress/circular.js +17 -26
- package/components/progress/linear.js +11 -13
- package/components/rating/index.js +114 -233
- package/components/slider/slider-container.js +15 -10
- package/components/slider/slider-item.js +10 -12
- package/components/status/index.js +63 -57
- package/components/tab/tab-container.js +26 -24
- package/components/tab/tab-header.js +36 -27
- package/components/tab/tab-panel.js +32 -15
- package/components/tab/tab.js +79 -80
- package/components/tooltip/index.js +4 -4
- package/components/transfer/index.js +10 -11
- package/components/tree-view/css.js +2 -0
- package/components/tree-view/index.js +14 -13
- package/components/typography/index.js +6 -112
- package/css/styles.css +1 -1
- package/css/styles.css.map +1 -1
- package/global/index.js +2 -0
- package/icons/basic.js +1648 -959
- package/icons/effect.js +45 -103
- package/package.json +1 -1
- package/readme.md +66 -0
- package/styles/color-helper.js +7 -146
- package/styles/colors.js +6 -2
- package/styles/font.js +9 -0
- package/styles/general.js +100 -7
- package/styles/typography.js +25 -26
- package/theme/settings.js +9 -2
- package/theme/theme-provider.js +15 -7
- package/theme/with-styles.js +2 -4
- package/theme/with-theme.js +2 -4
- package/utils/isMobile.js +21 -0
- package/utils/renderHTML.js +4 -5
- package/utils/renderIcon.js +15 -11
- package/utils/updatePosition.js +2 -2
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
@@ -7,17 +5,23 @@ import { memo, useState, useEffect, useRef, useImperativeHandle, forwardRef, Fra
|
|
|
7
5
|
import { createPortal } from 'react-dom';
|
|
8
6
|
import PropTypes from 'prop-types';
|
|
9
7
|
import { jsx, css } from '@emotion/core';
|
|
10
|
-
import { InputBase, Label } from '../../';
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
8
|
+
import { ButtonIcon, InputBase, Label } from '../../';
|
|
9
|
+
import { randomString } from '../../../utils';
|
|
10
|
+
import { color as colors } from '../../../styles/colors';
|
|
11
|
+
import { typography } from '../../../styles/typography';
|
|
12
|
+
import { borderBox, borderRadius4px, displayBlock, positionFixed, positionRelative } from '../../../styles/general';
|
|
13
|
+
const {
|
|
14
|
+
paragraph1
|
|
15
|
+
} = typography;
|
|
14
16
|
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
semantic: {
|
|
18
|
+
info
|
|
19
|
+
},
|
|
20
|
+
fill: {
|
|
21
|
+
disabled: fillDisabled,
|
|
22
|
+
'scrollbar-tabbar': scrollbar
|
|
19
23
|
}
|
|
20
|
-
} =
|
|
24
|
+
} = colors;
|
|
21
25
|
const timing = {};
|
|
22
26
|
const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
23
27
|
className,
|
|
@@ -37,6 +41,8 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
37
41
|
zIndex,
|
|
38
42
|
onOpened,
|
|
39
43
|
onClosed,
|
|
44
|
+
onChangeInput,
|
|
45
|
+
delayOnInput,
|
|
40
46
|
...props
|
|
41
47
|
}, reference) => {
|
|
42
48
|
const ref = useRef(null);
|
|
@@ -52,27 +58,27 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
52
58
|
|
|
53
59
|
const DropdownBoxRoot = css`
|
|
54
60
|
&.DGN-UI-Dropdown-Box {
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
${displayBlock}
|
|
62
|
+
${positionRelative}
|
|
57
63
|
min-width: 150px;
|
|
58
64
|
height: max-content;
|
|
59
65
|
.end-icon > .DGN-UI-Icon {
|
|
60
66
|
transition: transform 250ms;
|
|
61
67
|
}
|
|
62
68
|
&.dropdown-showing {
|
|
63
|
-
.end-icon > .DGN-UI-
|
|
69
|
+
.end-icon > .DGN-UI-ButtonIcon {
|
|
64
70
|
transform: rotateX(180deg);
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
.DGN-UI-InputBase {
|
|
68
|
-
background-color: ${bgColor ? bgColor === true ?
|
|
74
|
+
background-color: ${bgColor ? bgColor === true ? fillDisabled : bgColor : 'inherit'};
|
|
69
75
|
&.underlined {
|
|
70
76
|
height: 32px;
|
|
71
77
|
}
|
|
72
78
|
&.dropdown-focus {
|
|
73
79
|
background-color: inherit;
|
|
74
80
|
&::after {
|
|
75
|
-
border-bottom-color: ${
|
|
81
|
+
border-bottom-color: ${info};
|
|
76
82
|
transform: scaleX(1);
|
|
77
83
|
}
|
|
78
84
|
}
|
|
@@ -80,32 +86,30 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
80
86
|
}
|
|
81
87
|
`;
|
|
82
88
|
const DropdownBoxCSS = css`
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
${displayBlock}
|
|
90
|
+
${paragraph1};
|
|
91
|
+
${positionFixed}
|
|
92
|
+
${borderBox}
|
|
93
|
+
${borderRadius4px}
|
|
85
94
|
width: 100%;
|
|
86
95
|
height: auto;
|
|
87
96
|
max-height: 80%;
|
|
88
97
|
overflow: auto;
|
|
89
98
|
padding: 16px;
|
|
90
|
-
font-size: ${fontSize};
|
|
91
|
-
font-family: ${fontFamily};
|
|
92
99
|
background-color: #FFF;
|
|
93
|
-
box-sizing: border-box;
|
|
94
|
-
border-radius: 4px;
|
|
95
100
|
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
96
|
-
box-sizing: border-box;
|
|
97
101
|
opacity: 0;
|
|
98
102
|
transition: opacity 0.3s;
|
|
99
103
|
z-index: ${zIndex};
|
|
100
104
|
&::-webkit-scrollbar {
|
|
101
|
-
|
|
105
|
+
${borderRadius4px}
|
|
106
|
+
width: 8px;
|
|
102
107
|
background-color: #FFF !important;
|
|
103
|
-
border-radius: 4px;
|
|
104
108
|
}
|
|
105
109
|
&::-webkit-scrollbar-thumb {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
background-color: ${
|
|
110
|
+
${borderRadius4px}
|
|
111
|
+
mix-blend-mode: normal;
|
|
112
|
+
background-color: ${scrollbar} !important;
|
|
109
113
|
background-clip: content-box;
|
|
110
114
|
}
|
|
111
115
|
.DGN-UI-TreeView {
|
|
@@ -117,9 +121,9 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
117
121
|
/* Start handler */
|
|
118
122
|
|
|
119
123
|
const onTriggerDropdown = e => {
|
|
120
|
-
if (!
|
|
121
|
-
ref.current.classList.add('dropdown-showing');
|
|
122
|
-
inputBaseRef.current.classList.add('dropdown-focus');
|
|
124
|
+
if (!open) {
|
|
125
|
+
// ref.current.classList.add('dropdown-showing');
|
|
126
|
+
// inputBaseRef.current.classList.add('dropdown-focus');
|
|
123
127
|
openDropdownBox();
|
|
124
128
|
} else {
|
|
125
129
|
closeDropdownBox(true);
|
|
@@ -160,23 +164,22 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
160
164
|
};
|
|
161
165
|
|
|
162
166
|
const closeDropdownBox = certain => {
|
|
167
|
+
var _Array$from, _Array$from$classList;
|
|
168
|
+
|
|
163
169
|
const portals = document.querySelectorAll('.DGN-UI-Portal');
|
|
164
170
|
|
|
165
|
-
if (!certain && portals && portals.length > 1 && Array.from(portals)[portals.length - 1] && !Array.from(portals)[portals.length - 1].contains(ref.current)) {
|
|
171
|
+
if (!certain && portals && portals.length > 1 && Array.from(portals)[portals.length - 1] && !Array.from(portals)[portals.length - 1].contains(ref.current) && !((_Array$from = Array.from(portals)[portals.length - 1]) !== null && _Array$from !== void 0 && (_Array$from$classList = _Array$from.classList) !== null && _Array$from$classList !== void 0 && _Array$from$classList.contains('DGN-UI-Modal'))) {
|
|
166
172
|
return;
|
|
167
173
|
}
|
|
168
174
|
|
|
169
175
|
if (dropdownBoxRef.current) {
|
|
170
176
|
dropdownBoxRef.current.style.pointerEvents = `none`;
|
|
171
|
-
dropdownBoxRef.current.style.opacity = 0;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (inputBaseRef.current) {
|
|
178
|
-
inputBaseRef.current.classList.remove('dropdown-focus');
|
|
179
|
-
}
|
|
177
|
+
dropdownBoxRef.current.style.opacity = 0; // if (ref.current) {
|
|
178
|
+
// ref.current.classList.remove('dropdown-showing');
|
|
179
|
+
// }
|
|
180
|
+
// if (inputBaseRef.current) {
|
|
181
|
+
// inputBaseRef.current.classList.remove('dropdown-focus');
|
|
182
|
+
// }
|
|
180
183
|
|
|
181
184
|
document.removeEventListener('click', onClickOutsideOfInput);
|
|
182
185
|
timing[unique + 'Box'] = setTimeout(() => {
|
|
@@ -188,6 +191,14 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
188
191
|
}
|
|
189
192
|
};
|
|
190
193
|
|
|
194
|
+
const _onChangeInput = e => {
|
|
195
|
+
const value = e.target.value;
|
|
196
|
+
const timeout = setTimeout(() => {
|
|
197
|
+
onChangeInput === null || onChangeInput === void 0 ? void 0 : onChangeInput(value);
|
|
198
|
+
}, delayOnInput);
|
|
199
|
+
return () => clearTimeout(timeout);
|
|
200
|
+
};
|
|
201
|
+
|
|
191
202
|
useEffect(() => {
|
|
192
203
|
return () => {
|
|
193
204
|
closeDropdownBox();
|
|
@@ -203,19 +214,23 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
203
214
|
closeDropdownBox(true);
|
|
204
215
|
}
|
|
205
216
|
}));
|
|
206
|
-
const dropdownIcon = jsx(
|
|
217
|
+
const dropdownIcon = jsx(ButtonIcon, {
|
|
218
|
+
viewType: 'ghost',
|
|
207
219
|
name: 'ArrowDown',
|
|
208
220
|
onClick: openOnClickAt === 'icon' ? onTriggerDropdown : null,
|
|
209
221
|
ref: dropdownIconRef
|
|
210
222
|
});
|
|
211
|
-
return jsx(Fragment, null, jsx("div",
|
|
223
|
+
return jsx(Fragment, null, jsx("div", {
|
|
212
224
|
ref: ref,
|
|
213
225
|
css: DropdownBoxRoot,
|
|
214
|
-
className: ['DGN-UI-Dropdown-Box', className].join(' ').trim(),
|
|
215
|
-
style: style
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
226
|
+
className: ['DGN-UI-Dropdown-Box', open && 'dropdown-showing', className].join(' ').trim(),
|
|
227
|
+
style: style,
|
|
228
|
+
...props
|
|
229
|
+
}, label ? jsx(Label, {
|
|
230
|
+
required: required,
|
|
231
|
+
...labelProps
|
|
232
|
+
}, label) : null, jsx(InputBase, { ...inputProps,
|
|
233
|
+
className: open && 'dropdown-focus',
|
|
219
234
|
style: inputStyle,
|
|
220
235
|
viewType: viewType,
|
|
221
236
|
ref: inputBaseRef,
|
|
@@ -224,8 +239,9 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
224
239
|
value: value,
|
|
225
240
|
startIcon: startIcon,
|
|
226
241
|
endIcon: dropdownIcon,
|
|
242
|
+
onChange: _onChangeInput,
|
|
227
243
|
onClick: openOnClickAt === 'full' ? onTriggerDropdown : null
|
|
228
|
-
}))
|
|
244
|
+
})), open && /*#__PURE__*/createPortal(jsx("div", {
|
|
229
245
|
ref: dropdownBoxRef,
|
|
230
246
|
className: `DGN-UI-Portal DGN-DropdownBox-${unique}`,
|
|
231
247
|
css: DropdownBoxCSS
|
|
@@ -238,6 +254,7 @@ DropdownBox.defaultProps = {
|
|
|
238
254
|
startIcon: 'search',
|
|
239
255
|
openOnClickAt: 'icon',
|
|
240
256
|
inputProps: {},
|
|
257
|
+
delayOnInput: 700,
|
|
241
258
|
zIndex: 9001
|
|
242
259
|
};
|
|
243
260
|
DropdownBox.propTypes = {
|
|
@@ -274,6 +291,12 @@ DropdownBox.propTypes = {
|
|
|
274
291
|
/** style inline of input in DropdownBox component */
|
|
275
292
|
inputStyle: PropTypes.object,
|
|
276
293
|
|
|
294
|
+
/** the function will run when entering input */
|
|
295
|
+
onChangeInput: PropTypes.func,
|
|
296
|
+
|
|
297
|
+
/** delay time on input */
|
|
298
|
+
delayOnInput: PropTypes.number,
|
|
299
|
+
|
|
277
300
|
/** style inline of label in DropdownBox component */
|
|
278
301
|
labelProps: PropTypes.object,
|
|
279
302
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
@@ -96,11 +94,12 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
96
94
|
/* End handler */
|
|
97
95
|
|
|
98
96
|
useImperativeHandle(reference, () => ref.current);
|
|
99
|
-
return jsx("div",
|
|
97
|
+
return jsx("div", {
|
|
100
98
|
ref: ref,
|
|
101
99
|
css: FormGroupRoot,
|
|
102
|
-
className: ['DGN-UI-FormGroup', fullWidth ? 'Form-Group-full-width' : '', oneHelperText ? 'Form-Group-Common' : '', className].join(' ').trim()
|
|
103
|
-
|
|
100
|
+
className: ['DGN-UI-FormGroup', fullWidth ? 'Form-Group-full-width' : '', oneHelperText ? 'Form-Group-Common' : '', className].join(' ').trim(),
|
|
101
|
+
...props
|
|
102
|
+
}, children);
|
|
104
103
|
}));
|
|
105
104
|
MoneyInput.defaultProps = {
|
|
106
105
|
marginRight: 16,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
@@ -37,14 +35,15 @@ const HelperText = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
37
35
|
`;
|
|
38
36
|
/* End styled */
|
|
39
37
|
|
|
40
|
-
return jsx(Typography,
|
|
38
|
+
return jsx(Typography, {
|
|
41
39
|
ref: ref,
|
|
42
40
|
type: 'p3',
|
|
43
41
|
color: theme.colors.danger,
|
|
44
42
|
fullWidth: false,
|
|
45
43
|
css: HelperTextRoot,
|
|
46
|
-
className: ['DGN-UI-HelperText', className, status, disabled ? 'disabled' : ''].join(' ').trim()
|
|
47
|
-
|
|
44
|
+
className: ['DGN-UI-HelperText', className, status, disabled ? 'disabled' : ''].join(' ').trim(),
|
|
45
|
+
...props
|
|
46
|
+
}, typeof children === 'boolean' ? getGlobal('thisFieldIsRequired') : children);
|
|
48
47
|
}));
|
|
49
48
|
HelperText.defaultProps = {
|
|
50
49
|
disabled: false,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
@@ -8,12 +6,9 @@ import PropTypes from 'prop-types';
|
|
|
8
6
|
import { jsx, css } from '@emotion/core';
|
|
9
7
|
import { renderIcon } from '../../../utils';
|
|
10
8
|
import theme from '../../../theme/settings';
|
|
9
|
+
import { typography } from '../../../styles/typography';
|
|
11
10
|
const {
|
|
12
|
-
colors
|
|
13
|
-
typography: {
|
|
14
|
-
fontSize,
|
|
15
|
-
fontFamily
|
|
16
|
-
}
|
|
11
|
+
colors
|
|
17
12
|
} = theme;
|
|
18
13
|
const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
19
14
|
type,
|
|
@@ -226,16 +221,12 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
226
221
|
color: ${colors.input};
|
|
227
222
|
background-color: transparent;
|
|
228
223
|
padding-top: 0;
|
|
229
|
-
|
|
230
|
-
font-style: normal;
|
|
231
|
-
font-weight: 500;
|
|
232
|
-
font-size: ${fontSize};
|
|
233
|
-
line-height: 20px;
|
|
224
|
+
${typography.paragraph1};
|
|
234
225
|
height: 24px;
|
|
226
|
+
text-overflow: ellipsis;
|
|
235
227
|
&::placeholder {
|
|
236
228
|
color: ${colors.placeholder};
|
|
237
|
-
|
|
238
|
-
font-size: ${fontSize};
|
|
229
|
+
${typography.paragraph1};
|
|
239
230
|
}
|
|
240
231
|
&:focus {
|
|
241
232
|
background-color: transparent;
|
|
@@ -261,9 +252,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
261
252
|
const textAreaCSS = css`
|
|
262
253
|
display: block;
|
|
263
254
|
color: ${colors.input};
|
|
264
|
-
|
|
265
|
-
font-size: ${fontSize};
|
|
266
|
-
line-height: 20px;
|
|
255
|
+
${typography.paragraph1};
|
|
267
256
|
min-height: max-content;
|
|
268
257
|
min-width: max-content;
|
|
269
258
|
outline: none;
|
|
@@ -524,15 +513,16 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
524
513
|
/* Start component */
|
|
525
514
|
|
|
526
515
|
const newClass = (viewType === 'outlined' ? 'outlined' : 'underlined') + (nonStyle ? ' non-style' : '');
|
|
527
|
-
const MultipleInputComp = jsx("div",
|
|
516
|
+
const MultipleInputComp = jsx("div", {
|
|
528
517
|
css: multilineCSS,
|
|
529
518
|
className: ['DGN-UI-InputBase', newClass, className].join(' ').trim(),
|
|
530
|
-
ref: ref
|
|
531
|
-
|
|
519
|
+
ref: ref,
|
|
520
|
+
...props
|
|
521
|
+
}, jsx("textarea", {
|
|
532
522
|
type: "text",
|
|
533
523
|
placeholder: placeholder,
|
|
534
|
-
defaultValue: defaultValue
|
|
535
|
-
|
|
524
|
+
defaultValue: defaultValue,
|
|
525
|
+
...inputProps,
|
|
536
526
|
css: textAreaCSS,
|
|
537
527
|
readOnly: readOnly,
|
|
538
528
|
style: inputStyle || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.style),
|
|
@@ -544,19 +534,19 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
544
534
|
onChange: onChange,
|
|
545
535
|
onBlur: onBlur,
|
|
546
536
|
onFocus: onFocus
|
|
547
|
-
}))
|
|
548
|
-
const InputComp = jsx("div",
|
|
537
|
+
}));
|
|
538
|
+
const InputComp = jsx("div", {
|
|
549
539
|
css: inputBaseRoot,
|
|
550
|
-
ref: ref
|
|
551
|
-
|
|
540
|
+
ref: ref,
|
|
541
|
+
...props,
|
|
552
542
|
className: ['DGN-UI-InputBase', newClass, className, status].join(' ').trim()
|
|
553
|
-
}
|
|
543
|
+
}, jsx("div", {
|
|
554
544
|
css: inputBaseCSS
|
|
555
|
-
}, !!startIcon && jsx("div",
|
|
556
|
-
css: inputBaseIconCSS
|
|
557
|
-
|
|
545
|
+
}, !!startIcon && jsx("div", {
|
|
546
|
+
css: inputBaseIconCSS,
|
|
547
|
+
...startIconProps,
|
|
558
548
|
className: 'start-icon ' + (startIconProps.className ? startIconProps.className : '')
|
|
559
|
-
}
|
|
549
|
+
}, renderIcon(startIcon, typeof startIcon === 'string' && startIcon.length < 20 ? 'effect' : null, {
|
|
560
550
|
onClick: startIconProps.onClick ? null : () => inputBaseRef.current.focus(),
|
|
561
551
|
style: {
|
|
562
552
|
padding: 0,
|
|
@@ -564,12 +554,12 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
564
554
|
...iconStyle
|
|
565
555
|
},
|
|
566
556
|
viewBox: true
|
|
567
|
-
})), jsx("input",
|
|
557
|
+
})), jsx("input", {
|
|
568
558
|
type: type,
|
|
569
559
|
autoComplete: autoComplete,
|
|
570
560
|
placeholder: placeholder,
|
|
571
|
-
defaultValue: defaultValue
|
|
572
|
-
|
|
561
|
+
defaultValue: defaultValue,
|
|
562
|
+
...inputProps,
|
|
573
563
|
readOnly: readOnly,
|
|
574
564
|
style: inputStyle || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.style),
|
|
575
565
|
className: [newClass, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className].join(' '),
|
|
@@ -581,11 +571,11 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
581
571
|
onChange: onChange,
|
|
582
572
|
onBlur: onBlur,
|
|
583
573
|
onFocus: onFocus
|
|
584
|
-
}))
|
|
585
|
-
css: inputBaseIconCSS
|
|
586
|
-
|
|
574
|
+
})), !!endIcon && jsx("div", {
|
|
575
|
+
css: inputBaseIconCSS,
|
|
576
|
+
...endIconProps,
|
|
587
577
|
className: 'end-icon ' + (endIconProps.className ? endIconProps.className : '')
|
|
588
|
-
}
|
|
578
|
+
}, renderIcon(endIcon, null, {
|
|
589
579
|
style: {
|
|
590
580
|
padding: 0,
|
|
591
581
|
minHeight: '24px',
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
@@ -7,7 +5,19 @@ import { memo, useMemo, forwardRef } from 'react';
|
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
8
6
|
import { jsx, css } from '@emotion/core';
|
|
9
7
|
import { Typography } from '../../';
|
|
10
|
-
import
|
|
8
|
+
import { color as colors } from '../../../styles/colors';
|
|
9
|
+
import { ellipsis } from '../../../styles/general';
|
|
10
|
+
const {
|
|
11
|
+
system: {
|
|
12
|
+
disabled: systemDisabled
|
|
13
|
+
},
|
|
14
|
+
semantic: {
|
|
15
|
+
danger
|
|
16
|
+
},
|
|
17
|
+
text: {
|
|
18
|
+
normal_label
|
|
19
|
+
}
|
|
20
|
+
} = colors;
|
|
11
21
|
const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
12
22
|
required,
|
|
13
23
|
children,
|
|
@@ -17,29 +27,29 @@ const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
17
27
|
...props
|
|
18
28
|
}, ref) => {
|
|
19
29
|
const LabelRootCSS = css`
|
|
30
|
+
${ellipsis}
|
|
20
31
|
margin: 0px;
|
|
21
|
-
font-weight: bold !important;
|
|
22
32
|
&.read-only,
|
|
23
33
|
&.disabled {
|
|
24
|
-
color: ${
|
|
34
|
+
color: ${systemDisabled};
|
|
25
35
|
}
|
|
26
36
|
.required {
|
|
27
|
-
color: ${
|
|
37
|
+
color: ${danger};
|
|
28
38
|
}
|
|
29
39
|
& + .DGN-UI-InputBase.outlined {
|
|
30
40
|
margin-top: 2px;
|
|
31
41
|
}
|
|
32
42
|
`;
|
|
33
|
-
const LabelComp = useMemo(() => jsx(Typography,
|
|
34
|
-
type: '
|
|
35
|
-
color:
|
|
36
|
-
fullWidth: false
|
|
37
|
-
}, props, {
|
|
43
|
+
const LabelComp = useMemo(() => jsx(Typography, {
|
|
44
|
+
type: 'h6',
|
|
45
|
+
color: normal_label,
|
|
46
|
+
fullWidth: false,
|
|
38
47
|
ref: ref,
|
|
39
48
|
mapping: 'label',
|
|
40
49
|
css: LabelRootCSS,
|
|
41
|
-
className: ['DGN-UI-Label', className, readOnly ? 'read-only' : '', disabled ? 'disabled' : ''].join(' ').trim()
|
|
42
|
-
|
|
50
|
+
className: ['DGN-UI-Label', className, readOnly ? 'read-only' : '', disabled ? 'disabled' : ''].join(' ').trim(),
|
|
51
|
+
...props
|
|
52
|
+
}, children, required ? jsx("span", {
|
|
43
53
|
className: 'required'
|
|
44
54
|
}, " *") : null), [children, required, readOnly, disabled]);
|
|
45
55
|
return LabelComp;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
@@ -184,7 +182,8 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
184
182
|
const decimalSymbolDigit = (_local$current$clipbo = local.current.clipboardText.match(new RegExp(decimalSymbol, 'g'))) === null || _local$current$clipbo === void 0 ? void 0 : _local$current$clipbo.length;
|
|
185
183
|
const selectionText = window.getSelection().toString(); // Only includes number and decimalSymbol
|
|
186
184
|
|
|
187
|
-
if (!pattern.test(local.current.clipboardText) ||
|
|
185
|
+
if (!pattern.test(local.current.clipboardText) || // Only one decimalSymbol
|
|
186
|
+
decimalSymbolDigit && value.includes(decimalSymbol) && !selectionText.includes(decimalSymbol)) {
|
|
188
187
|
e.preventDefault();
|
|
189
188
|
return;
|
|
190
189
|
}
|
|
@@ -321,11 +320,12 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
321
320
|
return ref.current;
|
|
322
321
|
});
|
|
323
322
|
const validateResult = validates && onValidate(value, validates, true);
|
|
324
|
-
return jsx("div",
|
|
323
|
+
return jsx("div", {
|
|
325
324
|
ref: ref,
|
|
326
325
|
css: MoneyInputRoot,
|
|
327
|
-
className: ('DGN-UI-Money-Input ' + className).trim()
|
|
328
|
-
|
|
326
|
+
className: ('DGN-UI-Money-Input ' + className).trim(),
|
|
327
|
+
...props
|
|
328
|
+
}, !!label && jsx(Label, {
|
|
329
329
|
required: required,
|
|
330
330
|
disabled: disabled
|
|
331
331
|
}, label), jsx(InputBase, {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
@@ -227,6 +225,7 @@ const NumberInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
227
225
|
local.current.isSpecialSymbol = false;
|
|
228
226
|
local.current.isDeleteDecimalSymbol = key === 'Backspace' && value[cursor - 1] === decimalSymbol;
|
|
229
227
|
local.current.currentKey = key;
|
|
228
|
+
if (onKeyDown) onKeyDown(e);
|
|
230
229
|
};
|
|
231
230
|
|
|
232
231
|
const onPasteHandler = e => {
|
|
@@ -239,7 +238,8 @@ const NumberInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
239
238
|
const decimalSymbolDigit = (_local$current$clipbo = local.current.clipboardText.match(new RegExp(decimalSymbol, 'g'))) === null || _local$current$clipbo === void 0 ? void 0 : _local$current$clipbo.length;
|
|
240
239
|
let selectionText = window.getSelection().toString(); // Only includes number and decimalSymbol
|
|
241
240
|
|
|
242
|
-
if (!pattern.test(local.current.clipboardText.replaceAll(separatorSymbol.current, '')) ||
|
|
241
|
+
if (!pattern.test(local.current.clipboardText.replaceAll(separatorSymbol.current, '')) || // Only one decimalSymbol
|
|
242
|
+
decimalSymbolDigit && value.includes(decimalSymbol) && !selectionText.includes(decimalSymbol)) {
|
|
243
243
|
e.preventDefault();
|
|
244
244
|
return;
|
|
245
245
|
}
|
|
@@ -260,7 +260,7 @@ const NumberInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
260
260
|
let result = getValueWithMinMax(value);
|
|
261
261
|
|
|
262
262
|
if (/\d/.test(local.current.currentKey)) {
|
|
263
|
-
if (!!+result && result
|
|
263
|
+
if (!!+result && result < getValueWithMinMax(value.replace(local.current.currentKey, ''))) {
|
|
264
264
|
e.target.value = local.current.currentValue;
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
@@ -397,13 +397,10 @@ const NumberInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
397
397
|
|
|
398
398
|
if (defaultValue !== undefined && defaultValue !== '') {
|
|
399
399
|
setValueIntoInput(defaultValue);
|
|
400
|
-
}
|
|
400
|
+
} // inputRef.current.addEventListener('focus', () => {
|
|
401
|
+
// inputRef.current.addEventListener('keydown', onKeyDownHandler);
|
|
402
|
+
// }, {once: true});
|
|
401
403
|
|
|
402
|
-
inputRef.current.addEventListener('focus', () => {
|
|
403
|
-
inputRef.current.addEventListener('keydown', onKeyDownHandler);
|
|
404
|
-
}, {
|
|
405
|
-
once: true
|
|
406
|
-
});
|
|
407
404
|
}, []);
|
|
408
405
|
useEffect(() => {
|
|
409
406
|
if (placeholder !== undefined) {
|
|
@@ -460,10 +457,11 @@ const NumberInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
460
457
|
ref.current.getValueWithMinMax = getValueWithMinMax;
|
|
461
458
|
return ref.current;
|
|
462
459
|
});
|
|
463
|
-
return jsx("div",
|
|
460
|
+
return jsx("div", {
|
|
464
461
|
ref: ref,
|
|
465
|
-
css: NumberInputRoot
|
|
466
|
-
|
|
462
|
+
css: NumberInputRoot,
|
|
463
|
+
...props
|
|
464
|
+
}, !!label && jsx(Label, {
|
|
467
465
|
required: required,
|
|
468
466
|
disabled: disabled
|
|
469
467
|
}, label), jsx(InputBase, {
|
|
@@ -485,7 +483,7 @@ const NumberInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
485
483
|
onBlur: onBlurHandler,
|
|
486
484
|
onFocus: onFocus,
|
|
487
485
|
onInput: onInput,
|
|
488
|
-
onKeyDown:
|
|
486
|
+
onKeyDown: onKeyDownHandler,
|
|
489
487
|
onKeyUp: onKeyUp,
|
|
490
488
|
onPaste: onPasteHandler
|
|
491
489
|
}), !!error && jsx(HelperText, {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
@@ -295,13 +293,14 @@ const PhoneInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
295
293
|
useImperativeHandle(reference, () => ({
|
|
296
294
|
get: () => ref.current
|
|
297
295
|
}));
|
|
298
|
-
return jsx("div",
|
|
296
|
+
return jsx("div", {
|
|
299
297
|
ref: ref,
|
|
300
298
|
css: PhoneInputRoot,
|
|
301
299
|
style: {
|
|
302
300
|
marginBottom: '20px'
|
|
303
|
-
}
|
|
304
|
-
|
|
301
|
+
},
|
|
302
|
+
...props
|
|
303
|
+
}, jsx(Label, {
|
|
305
304
|
required: required,
|
|
306
305
|
disabled: disabled
|
|
307
306
|
}, label), jsx(InputBase, {
|