diginet-core-ui 1.3.78 → 1.3.79
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/details.js +2 -6
- package/components/accordion/group.js +2 -9
- package/components/accordion/index.js +2 -15
- package/components/accordion/summary.js +4 -27
- package/components/alert/index.js +98 -137
- package/components/alert/notify.js +97 -166
- package/components/avatar/index.js +4 -63
- package/components/badge/index.js +7 -34
- package/components/button/icon.js +120 -186
- package/components/button/index.js +136 -205
- package/components/button/more.js +0 -12
- package/components/button/ripple-effect.js +46 -44
- package/components/card/body.js +2 -7
- package/components/card/extra.js +2 -7
- package/components/card/footer.js +2 -7
- package/components/card/header.js +2 -7
- package/components/card/index.js +2 -22
- package/components/chart/Pie/Circle.js +0 -1
- package/components/chart/Pie/Sector.js +0 -17
- package/components/chart/Pie/Sectors.js +0 -10
- package/components/chart/Pie/index.js +4 -36
- package/components/chart/Pie-v2/Circle.js +0 -1
- package/components/chart/Pie-v2/Sector.js +0 -13
- package/components/chart/Pie-v2/Sectors.js +0 -20
- package/components/chart/Pie-v2/index.js +11 -38
- package/components/chart/bar/Axis.js +0 -12
- package/components/chart/bar/Bar.js +13 -35
- package/components/chart/bar/Grid.js +0 -18
- package/components/chart/bar/Labels.js +0 -18
- package/components/chart/bar/Points.js +0 -17
- package/components/chart/bar/index.js +6 -26
- package/components/chart/bar-v2/Axis.js +0 -12
- package/components/chart/bar-v2/Bar.js +15 -36
- package/components/chart/bar-v2/Grid.js +0 -18
- package/components/chart/bar-v2/Labels.js +0 -18
- package/components/chart/bar-v2/Points.js +0 -17
- package/components/chart/bar-v2/index.js +6 -26
- package/components/chart/line/Axis.js +4 -16
- package/components/chart/line/Grid.js +2 -19
- package/components/chart/line/Labels.js +0 -18
- package/components/chart/line/Path.js +23 -33
- package/components/chart/line/Point.js +6 -40
- package/components/chart/line/Title.js +0 -3
- package/components/chart/line/index.js +12 -35
- package/components/chart/line-v2/Axis.js +0 -13
- package/components/chart/line-v2/Grid.js +0 -18
- package/components/chart/line-v2/Labels.js +0 -18
- package/components/chart/line-v2/Path.js +23 -33
- package/components/chart/line-v2/Point.js +6 -35
- package/components/chart/line-v2/Title.js +0 -3
- package/components/chart/line-v2/index.js +12 -30
- package/components/check-text/index.js +0 -8
- package/components/check-text/interview-confirmation.js +0 -7
- package/components/check-text/interview-status.js +0 -7
- package/components/chip/attach.js +4 -17
- package/components/chip/index.js +6 -33
- package/components/collapse/index.js +0 -13
- package/components/divider/index.js +0 -8
- package/components/form-control/attachment/index.js +24 -202
- package/components/form-control/calendar/function.js +40 -94
- package/components/form-control/calendar/index.js +5 -30
- package/components/form-control/calendar/range.js +11 -28
- package/components/form-control/checkbox/index.js +4 -37
- package/components/form-control/control/index.js +3 -13
- package/components/form-control/date-picker/index-old.js +18 -0
- package/components/form-control/date-picker/index.js +23 -99
- package/components/form-control/date-range-picker/index.js +86 -221
- package/components/form-control/dropdown/index.js +72 -289
- package/components/form-control/dropdown-box/index.js +6 -35
- package/components/form-control/form/index.js +0 -2
- package/components/form-control/form-group/index.js +1 -6
- package/components/form-control/helper-text/index.js +2 -9
- package/components/form-control/input-base/index.js +218 -399
- package/components/form-control/label/index.js +2 -12
- package/components/form-control/money-input/index.js +43 -132
- package/components/form-control/number-input/index.js +15 -113
- package/components/form-control/number-input/index2.js +78 -119
- package/components/form-control/phone-input/index.js +16 -78
- package/components/form-control/radio/index.js +4 -23
- package/components/form-control/text-input/index.js +33 -256
- package/components/form-control/time-picker/index.js +14 -71
- package/components/form-control/time-picker/swiper.js +21 -73
- package/components/form-control/toggle/index.js +4 -19
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +0 -14
- package/components/form-view/input.js +2 -13
- package/components/form-view/label.js +0 -2
- package/components/grid/Col.js +2 -15
- package/components/grid/Container.js +2 -21
- package/components/grid/Row.js +2 -21
- package/components/grid/index.js +2 -43
- package/components/image/index.js +2 -22
- package/components/index.js +62 -31
- package/components/list/list-item-action.js +0 -9
- package/components/list/list-item-icon.js +0 -9
- package/components/list/list-item-text.js +0 -5
- package/components/list/list-item.js +0 -11
- package/components/list/list.js +0 -13
- package/components/list/sub-header.js +0 -4
- package/components/modal/body.js +2 -6
- package/components/modal/footer.js +2 -11
- package/components/modal/header.js +2 -12
- package/components/modal/index.js +2 -10
- package/components/modal/modal.js +11 -52
- package/components/others/extra/index.js +3 -10
- package/components/others/import/index.js +0 -7
- package/components/others/option-wrapper/index.js +4 -7
- package/components/others/scrollbar/index.js +0 -3
- package/components/paging/page-info.js +39 -101
- package/components/paging/page-selector.js +7 -35
- package/components/paging/page-selector2.js +35 -74
- package/components/paper/index.js +0 -11
- package/components/popover/body.js +2 -6
- package/components/popover/footer.js +2 -11
- package/components/popover/header.js +2 -7
- package/components/popover/index.js +39 -123
- package/components/popup/danger_popup.js +0 -19
- package/components/popup/index.js +2 -48
- package/components/popup/proposals_popup.js +10 -49
- package/components/popup/v2/index.js +0 -31
- package/components/progress/circular.js +19 -81
- package/components/progress/linear.js +4 -20
- package/components/rating/index.js +0 -24
- package/components/slider/slider-container.js +3 -40
- package/components/slider/slider-item.js +10 -25
- package/components/status/index.js +2 -16
- package/components/tab/tab-container.js +2 -16
- package/components/tab/tab-header.js +4 -24
- package/components/tab/tab-panel.js +4 -16
- package/components/tab/tab.js +4 -28
- package/components/tooltip/index.js +12 -97
- package/components/tooltip/portal.js +0 -2
- package/components/transfer/index.js +22 -67
- package/components/tree-view/index.js +62 -202
- package/components/typography/index.js +3 -31
- package/global/index.js +0 -8
- package/icons/basic.js +0 -48
- package/icons/effect.js +17 -29
- package/icons/general/clock/clock.js +0 -2
- package/icons/general/color-handler/background.js +0 -2
- package/icons/general/color-handler/text.js +0 -2
- package/icons/general/emoji/emoji.js +0 -2
- package/icons/general/font-properties/bold.js +0 -2
- package/icons/general/font-properties/font-family.js +0 -2
- package/icons/general/font-properties/font-size.js +0 -2
- package/icons/general/font-properties/italic.js +0 -2
- package/icons/general/font-properties/underline.js +0 -2
- package/icons/general/hyperlink/hyperlink.js +0 -2
- package/icons/general/indent/decrease.js +0 -2
- package/icons/general/indent/increase.js +0 -2
- package/icons/general/list/bullets.js +0 -2
- package/icons/general/list/numbering.js +0 -2
- package/icons/general/picture/picture.js +0 -2
- package/icons/general/steps/redo.js +0 -2
- package/icons/general/steps/undo.js +0 -2
- package/icons/general/text-align/center.js +0 -2
- package/icons/general/text-align/justify.js +0 -2
- package/icons/general/text-align/left.js +0 -2
- package/icons/general/text-align/right.js +0 -2
- package/icons/menu/dhr.js +2 -1
- package/icons/menu/index.js +2 -2
- package/icons/menu/v2/index.js +0 -10
- package/package.json +1 -1
- package/readme.md +11 -1
- package/styles/animation.js +15 -58
- package/styles/color-helper.js +24 -54
- package/styles/colors.js +17 -9
- package/styles/general.js +6 -2
- package/styles/typography.js +4 -4
- package/styles/utils.js +2 -2
- package/theme/createBreakpoints.js +7 -18
- package/theme/make-styles.js +2 -5
- package/theme/set-theme.js +3 -6
- package/theme/settings.js +3 -2
- package/theme/theme-provider.js +0 -1
- package/utils/array/array.js +14 -23
- package/utils/classNames.js +0 -5
- package/utils/console.js +0 -6
- package/utils/date.js +13 -82
- package/utils/error/error.js +1 -9
- package/utils/error/errors.js +1 -48
- package/utils/getFileType.js +0 -9
- package/utils/handleBreakpoints.js +0 -5
- package/utils/intersectionObserver.js +0 -5
- package/utils/iterator.js +0 -9
- package/utils/map-parent.js +3 -10
- package/utils/object/extend.js +0 -10
- package/utils/object/object.js +12 -11
- package/utils/parseHTML.js +0 -1
- package/utils/promisify.js +0 -5
- package/utils/randomString.js +0 -7
- package/utils/remove-unicode.js +0 -1
- package/utils/render-portal.js +1 -9
- package/utils/renderHTML.js +4 -6
- package/utils/renderIcon.js +4 -14
- package/utils/sb-template.js +6 -5
- package/utils/string/capitalize.js +0 -1
- package/utils/string/capitalizeSentenceCase.js +0 -2
- package/utils/string/string.js +0 -13
- package/utils/type.js +0 -21
- package/utils/updatePosition.js +4 -5
- package/utils/useDelayUnmount.js +0 -4
- package/utils/useElementSize.js +9 -3
- package/utils/useEventListener.js +12 -6
- package/utils/useInput.js +0 -6
- package/utils/useMediaQuery.js +8 -10
- package/utils/useOnClickOutside.js +0 -2
- package/utils/usePortal.js +3 -10
- package/utils/validate.js +6 -20
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
|
-
import {
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
6
|
+
import { HelperText, InputBase, Label } from '../../';
|
|
7
|
+
import { cursorNotAllowed, displayBlock, positionRelative } from '../../../styles/general';
|
|
8
|
+
import { useTheme } from '../../../theme';
|
|
9
|
+
import { classNames, onValidate, refType as ref } from '../../../utils';
|
|
10
|
+
const {
|
|
11
|
+
spacing
|
|
12
|
+
} = useTheme();
|
|
10
13
|
const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
14
|
+
action = {},
|
|
11
15
|
autoComplete,
|
|
12
16
|
autoFocus,
|
|
13
17
|
autoWidth,
|
|
@@ -19,19 +23,16 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
19
23
|
error,
|
|
20
24
|
helperTextProps,
|
|
21
25
|
hoverTooltip,
|
|
22
|
-
icon,
|
|
23
|
-
iconStyle,
|
|
24
26
|
inputProps,
|
|
25
27
|
inputRef,
|
|
26
28
|
inputStyle,
|
|
27
29
|
label,
|
|
28
30
|
labelProps,
|
|
29
|
-
loading,
|
|
30
31
|
maxRows,
|
|
31
32
|
multiline,
|
|
33
|
+
nonStyle,
|
|
32
34
|
onBlur,
|
|
33
35
|
onChange,
|
|
34
|
-
onConfirm,
|
|
35
36
|
onFocus,
|
|
36
37
|
onInput,
|
|
37
38
|
onKeyDown,
|
|
@@ -52,197 +53,29 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
52
53
|
...props
|
|
53
54
|
}, reference) => {
|
|
54
55
|
const ref = useRef(null);
|
|
55
|
-
|
|
56
56
|
if (!inputRef) {
|
|
57
57
|
inputRef = useRef(null);
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
const iconRef = useRef(null);
|
|
61
|
-
let currentValue = '';
|
|
62
59
|
const [value, setValue] = useState(valueProp || defaultValue);
|
|
63
60
|
const isError = !!error;
|
|
64
|
-
/* Start handler */
|
|
65
|
-
|
|
66
|
-
const onMouseDownHandler = () => {
|
|
67
|
-
inputRef.current.style.backgroundColor = 'transparent';
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const onPressTab = e => {
|
|
71
|
-
if (e.key === 'Tab') {
|
|
72
|
-
onClickOutsideOfInput({
|
|
73
|
-
target: null
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const onFocusInput = () => {
|
|
79
|
-
if (!inputRef.current.readOnly) {
|
|
80
|
-
iconRef.current.querySelector('.edit-icon-pen').style.display = 'none';
|
|
81
|
-
iconRef.current.querySelector('.edit-icon-confirm').style.display = 'flex';
|
|
82
|
-
iconRef.current.querySelector('.edit-icon-clear').style.display = 'flex';
|
|
83
|
-
document.addEventListener('click', onClickOutsideOfInput);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const onClickOutsideOfInput = event => {
|
|
88
|
-
if (!inputRef.current || !iconRef.current) {
|
|
89
|
-
document.removeEventListener('click', onClickOutsideOfInput);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (!inputRef.current.contains(event.target) && !iconRef.current.contains(event.target)) {
|
|
94
|
-
if (!inputRef.current.readOnly) {
|
|
95
|
-
onConfirmEdit();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
document.removeEventListener('click', onClickOutsideOfInput);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const onClickQuickEdit = () => {
|
|
103
|
-
inputRef.current.focus();
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const onConfirmEdit = () => {
|
|
107
|
-
const value = inputRef.current.value;
|
|
108
|
-
|
|
109
|
-
if (!value || value === currentValue) {
|
|
110
|
-
inputRef.current.value = currentValue;
|
|
111
|
-
goToStart();
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
currentValue = value;
|
|
116
|
-
if (onConfirm) onConfirm({
|
|
117
|
-
value
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const onClear = () => {
|
|
122
|
-
inputRef.current.value = '';
|
|
123
|
-
inputRef.current.focus();
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const goToStart = () => {
|
|
127
|
-
iconRef.current.querySelector('.circular').style.display = null;
|
|
128
|
-
iconRef.current.querySelector('.edit-icon-pen').style.display = null;
|
|
129
|
-
iconRef.current.querySelector('.edit-icon-confirm').style.display = null;
|
|
130
|
-
iconRef.current.querySelector('.edit-icon-confirm').style.opacity = null;
|
|
131
|
-
iconRef.current.querySelector('.edit-icon-clear').style = null;
|
|
132
|
-
inputRef.current.disabled = false;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
61
|
useEffect(() => {
|
|
136
62
|
setValue(valueProp);
|
|
137
63
|
}, [valueProp]);
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
inputRef.current.focus();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return () => {
|
|
152
|
-
if (/^(quick)?Edit/i.test(type) && !multiline) {
|
|
153
|
-
if (inputRef.current) {
|
|
154
|
-
inputRef.current.removeEventListener('focus', onFocusInput);
|
|
155
|
-
inputRef.current.removeEventListener('keydown', onPressTab);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
}, [type, multiline]);
|
|
160
|
-
useEffect(() => {
|
|
161
|
-
if (!inputRef.current) return;
|
|
162
|
-
inputRef.current.readOnly = !!readOnly;
|
|
163
|
-
|
|
164
|
-
if (/^(quick)?Edit/i.test(type) && !multiline && readOnly) {
|
|
165
|
-
inputRef.current.parentNode.parentNode.classList.add('readOnly');
|
|
166
|
-
iconRef.current.querySelector('.edit-icon-pen').style.pointerEvents = 'none';
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (disabled) {
|
|
170
|
-
ref.current.classList.add('disabled');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return () => {
|
|
174
|
-
if (/^(quick)?Edit/i.test(type) && !multiline && readOnly) {
|
|
175
|
-
inputRef.current.parentNode.parentNode.classList.remove('readOnly');
|
|
176
|
-
iconRef.current.querySelector('.edit-icon-pen').style.pointerEvents = null;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
ref.current && ref.current.classList.remove('disabled');
|
|
180
|
-
};
|
|
181
|
-
}, [disabled, readOnly]);
|
|
182
|
-
useEffect(() => {
|
|
183
|
-
if (/^(quick)?Edit/i.test(type) && iconRef.current) {
|
|
184
|
-
if (loading) {
|
|
185
|
-
iconRef.current.querySelector('.circular').style.display = 'flex';
|
|
186
|
-
iconRef.current.querySelector('.edit-icon-confirm').style.opacity = 0;
|
|
187
|
-
iconRef.current.querySelector('.edit-icon-clear').style.pointerEvents = 'none';
|
|
188
|
-
inputRef.current.disabled = true;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return () => {
|
|
192
|
-
if (loading) {
|
|
193
|
-
goToStart();
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
}, [loading]);
|
|
198
|
-
/* End handler */
|
|
199
|
-
|
|
200
|
-
useImperativeHandle(reference, () => ({
|
|
201
|
-
element: ref.current,
|
|
202
|
-
instance: {}
|
|
203
|
-
}));
|
|
64
|
+
useImperativeHandle(reference, () => {
|
|
65
|
+
const currentRef = ref.current || {};
|
|
66
|
+
currentRef.element = ref.current;
|
|
67
|
+
const _instance = {
|
|
68
|
+
...action
|
|
69
|
+
}; // methods
|
|
70
|
+
_instance.__proto__ = {}; // hidden methods
|
|
71
|
+
currentRef.instance = _instance;
|
|
72
|
+
return currentRef;
|
|
73
|
+
});
|
|
204
74
|
const validateResult = validates && onValidate(value, validates, true);
|
|
205
|
-
const startIconCustom = icon && type !== 'inform' ? icon : startIcon;
|
|
206
|
-
const endIconCustom = /^inform$/i.test(type) ? jsx("div", {
|
|
207
|
-
ref: iconRef,
|
|
208
|
-
css: TextInputIcon,
|
|
209
|
-
style: {
|
|
210
|
-
maxHeight: '20px'
|
|
211
|
-
}
|
|
212
|
-
}, renderIcon(icon, null, {
|
|
213
|
-
style: {
|
|
214
|
-
maxHeight: '20px',
|
|
215
|
-
...iconStyle
|
|
216
|
-
}
|
|
217
|
-
})) : /^(quick)?Edit/i.test(type) ? jsx("div", {
|
|
218
|
-
ref: iconRef,
|
|
219
|
-
css: TextInputIcon
|
|
220
|
-
}, jsx(ButtonIcon, {
|
|
221
|
-
viewType: 'ghost',
|
|
222
|
-
name: 'Edit',
|
|
223
|
-
className: 'edit-icon-pen',
|
|
224
|
-
onClick: onClickQuickEdit
|
|
225
|
-
}), jsx(ButtonIcon, {
|
|
226
|
-
viewType: 'ghost',
|
|
227
|
-
name: 'Approval',
|
|
228
|
-
className: 'edit-icon-confirm',
|
|
229
|
-
onClick: onConfirmEdit
|
|
230
|
-
}), jsx("span", {
|
|
231
|
-
className: 'circular'
|
|
232
|
-
}, jsx(Circular, {
|
|
233
|
-
width: 24,
|
|
234
|
-
strokeWidth: 2
|
|
235
|
-
})), jsx(ButtonIcon, {
|
|
236
|
-
viewType: 'ghost',
|
|
237
|
-
name: 'Close',
|
|
238
|
-
className: 'edit-icon-clear',
|
|
239
|
-
onClick: onClear,
|
|
240
|
-
onMouseDown: onMouseDownHandler
|
|
241
|
-
})) : endIcon;
|
|
242
75
|
return jsx("div", {
|
|
243
76
|
ref: ref,
|
|
244
77
|
css: TextInputRoot,
|
|
245
|
-
className:
|
|
78
|
+
className: classNames('DGN-UI-TextInput', className, disabled && 'disabled'),
|
|
246
79
|
style: style,
|
|
247
80
|
...props
|
|
248
81
|
}, !!label && jsx(Label, {
|
|
@@ -266,9 +99,9 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
266
99
|
status: isError || validateResult ? 'danger' : status,
|
|
267
100
|
inputProps: inputProps,
|
|
268
101
|
inputStyle: inputStyle,
|
|
269
|
-
startIcon:
|
|
102
|
+
startIcon: startIcon,
|
|
270
103
|
startIconProps: startIconProps,
|
|
271
|
-
endIcon:
|
|
104
|
+
endIcon: endIcon,
|
|
272
105
|
endIconProps: endIconProps,
|
|
273
106
|
onChange: onChange,
|
|
274
107
|
onBlur: onBlur,
|
|
@@ -278,39 +111,25 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
278
111
|
onKeyUp: onKeyUp,
|
|
279
112
|
onPaste: onPaste,
|
|
280
113
|
value: valueProp,
|
|
281
|
-
hoverTooltip: hoverTooltip
|
|
282
|
-
|
|
114
|
+
hoverTooltip: hoverTooltip,
|
|
115
|
+
nonStyle: nonStyle
|
|
116
|
+
}), isError && jsx(HelperText, {
|
|
117
|
+
...helperTextProps,
|
|
283
118
|
disabled: disabled,
|
|
284
119
|
status: status
|
|
285
|
-
}, error), !isError && validateResult && jsx(HelperText, {
|
|
120
|
+
}, error), !isError && validateResult && jsx(HelperText, {
|
|
121
|
+
...helperTextProps,
|
|
286
122
|
disabled: disabled
|
|
287
123
|
}, validateResult));
|
|
288
124
|
}));
|
|
289
125
|
const TextInputRoot = css`
|
|
290
126
|
${displayBlock};
|
|
291
127
|
${positionRelative};
|
|
292
|
-
margin-bottom:
|
|
128
|
+
margin-bottom: ${spacing([5])};
|
|
293
129
|
&.disabled {
|
|
294
130
|
${cursorNotAllowed};
|
|
295
131
|
}
|
|
296
132
|
`;
|
|
297
|
-
const TextInputIcon = css`
|
|
298
|
-
${flexRow};
|
|
299
|
-
color: inherit;
|
|
300
|
-
.edit-icon-pen {
|
|
301
|
-
${flexRow};
|
|
302
|
-
}
|
|
303
|
-
.edit-icon-confirm {
|
|
304
|
-
display: none;
|
|
305
|
-
}
|
|
306
|
-
.edit-icon-clear {
|
|
307
|
-
display: none;
|
|
308
|
-
margin-left: 12px;
|
|
309
|
-
}
|
|
310
|
-
.circular {
|
|
311
|
-
display: none;
|
|
312
|
-
}
|
|
313
|
-
`;
|
|
314
133
|
TextInput.defaultProps = {
|
|
315
134
|
autoComplete: 'off',
|
|
316
135
|
autoFocus: false,
|
|
@@ -320,9 +139,7 @@ TextInput.defaultProps = {
|
|
|
320
139
|
disabled: false,
|
|
321
140
|
hoverTooltip: false,
|
|
322
141
|
error: '',
|
|
323
|
-
iconStyle: {},
|
|
324
142
|
label: '',
|
|
325
|
-
loading: false,
|
|
326
143
|
multiline: false,
|
|
327
144
|
readOnly: false,
|
|
328
145
|
required: false,
|
|
@@ -333,117 +150,77 @@ TextInput.defaultProps = {
|
|
|
333
150
|
TextInput.propTypes = {
|
|
334
151
|
/** This prop helps users to fill forms faster, especially on mobile devices. The name can be confusing, as it's more like an autofill. You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill). */
|
|
335
152
|
autoComplete: PropTypes.string,
|
|
336
|
-
|
|
337
153
|
/** If `true`, the input element is focused during the first mount. */
|
|
338
154
|
autoFocus: PropTypes.bool,
|
|
339
|
-
|
|
340
155
|
/** If `true`, the width of the component will automatically be set according to the contents inside the input, don't run with multiline = true */
|
|
341
156
|
autoWidth: PropTypes.bool,
|
|
342
|
-
|
|
343
157
|
/** Class for component. */
|
|
344
158
|
className: PropTypes.string,
|
|
345
|
-
|
|
346
159
|
/** The default value. Use when the component is not controlled. */
|
|
347
160
|
defaultValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
348
|
-
|
|
349
161
|
/** If `true`, the component is disabled.*/
|
|
350
162
|
disabled: PropTypes.bool,
|
|
351
|
-
|
|
352
163
|
/** [Icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic--basic) or element placed to the right of input. */
|
|
353
164
|
endIcon: PropTypes.any,
|
|
354
|
-
|
|
355
165
|
/** Props of end icon in InputBase component. */
|
|
356
166
|
endIconProps: PropTypes.object,
|
|
357
|
-
|
|
358
167
|
/** Error displayed below input. */
|
|
359
168
|
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
360
|
-
|
|
361
169
|
/** [Props](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) of helper text. */
|
|
362
170
|
helperTextProps: PropTypes.object,
|
|
363
|
-
|
|
364
|
-
/** Icon element display in the end of input (only use for type is inform, if not, use startIcon instead). */
|
|
365
|
-
icon: PropTypes.any,
|
|
366
|
-
|
|
367
|
-
/** Style inline of icon. */
|
|
368
|
-
iconStyle: PropTypes.object,
|
|
369
|
-
|
|
370
171
|
/** [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes) applied to the input element. */
|
|
371
172
|
inputProps: PropTypes.object,
|
|
372
|
-
|
|
373
173
|
/** Pass a ref to the input element. */
|
|
374
174
|
inputRef: ref,
|
|
375
|
-
|
|
376
175
|
/** Style inline of input element. */
|
|
377
176
|
inputStyle: PropTypes.object,
|
|
378
|
-
|
|
379
177
|
/** The label of the component. */
|
|
380
178
|
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
381
|
-
|
|
382
179
|
/** [Props](https://core.diginet.com.vn/ui/?path=/docs/form-control-text-label--simple) of label. */
|
|
383
180
|
labelProps: PropTypes.object,
|
|
384
|
-
|
|
385
181
|
/** Maximum number of rows to display when multiline option is set to true. */
|
|
386
182
|
maxRows: PropTypes.number,
|
|
387
|
-
|
|
388
183
|
/** If `true`, a textarea element is rendered. */
|
|
389
184
|
multiline: PropTypes.bool,
|
|
390
|
-
|
|
391
185
|
/** Callback fired when the input is blurred. */
|
|
392
186
|
onBlur: PropTypes.func,
|
|
393
|
-
|
|
394
187
|
/** Callback fired when the value is changed. */
|
|
395
188
|
onChange: PropTypes.func,
|
|
396
|
-
|
|
397
189
|
/** Callback fired when the input is focused. */
|
|
398
190
|
onFocus: PropTypes.func,
|
|
399
|
-
|
|
400
191
|
/** Callback fired when input. */
|
|
401
192
|
onInput: PropTypes.func,
|
|
402
|
-
|
|
403
193
|
/** Callback fired when pressing a key. */
|
|
404
194
|
onKeyDown: PropTypes.func,
|
|
405
|
-
|
|
406
195
|
/** Callback fired when releases a key. */
|
|
407
196
|
onKeyUp: PropTypes.func,
|
|
408
|
-
|
|
409
197
|
/** The short hint displayed in the input before the user enters a value. */
|
|
410
198
|
placeholder: PropTypes.string,
|
|
411
|
-
|
|
412
199
|
/** If `true`, the component is readOnly. */
|
|
413
200
|
readOnly: PropTypes.bool,
|
|
414
|
-
|
|
415
201
|
/** If `true`, the input element is required. */
|
|
416
202
|
required: PropTypes.bool,
|
|
417
|
-
|
|
418
203
|
/** Number of rows to display when multiline option is set to true. */
|
|
419
204
|
rows: PropTypes.number,
|
|
420
|
-
|
|
421
205
|
/** [Icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic--basic) or element placed to the left of input. */
|
|
422
206
|
startIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
423
|
-
|
|
424
207
|
/** Props of start icon in InputBase component. */
|
|
425
208
|
startIconProps: PropTypes.object,
|
|
426
|
-
|
|
427
209
|
/** Status type to display color for input. */
|
|
428
210
|
status: PropTypes.oneOf(['default', 'warning', 'success', 'danger']),
|
|
429
|
-
|
|
430
211
|
/** Style inline of component. */
|
|
431
212
|
style: PropTypes.object,
|
|
432
|
-
|
|
433
213
|
/** Type of the input element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types). */
|
|
434
|
-
type: PropTypes.oneOf(['inform', 'edit', '
|
|
435
|
-
|
|
214
|
+
type: PropTypes.oneOf(['inform', 'edit', 'text', 'number', 'password']),
|
|
436
215
|
/** Validation value, argument can:<br/>
|
|
437
216
|
* * string: the validation rule. Example required.<br/>
|
|
438
217
|
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
439
218
|
* * array: the validation rule list, insist object/string
|
|
440
219
|
*/
|
|
441
220
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
442
|
-
|
|
443
221
|
/** The value of the input element, required for a controlled component. */
|
|
444
222
|
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
445
|
-
|
|
446
223
|
/** The variant to use. */
|
|
447
|
-
viewType: PropTypes.oneOf(['underlined', 'outlined'])
|
|
224
|
+
viewType: PropTypes.oneOf(['underlined', 'outlined', 'none'])
|
|
448
225
|
};
|
|
449
226
|
export default TextInput;
|