diginet-core-ui 1.3.73 → 1.3.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/images/menu/dhr/MHRP29N0026.svg +13 -0
- package/assets/images/menu/dhr/MHRP29N0027.svg +14 -0
- package/assets/images/menu/dhr/MHRP29N0028.svg +15 -0
- package/components/accordion/details.js +19 -10
- package/components/accordion/group.js +15 -6
- package/components/accordion/index.js +20 -11
- package/components/accordion/summary.js +18 -9
- package/components/avatar/index.js +1 -1
- package/components/badge/index.js +17 -9
- package/components/button/icon.js +33 -25
- package/components/button/index.js +25 -17
- package/components/card/body.js +12 -4
- package/components/card/extra.js +12 -4
- package/components/card/footer.js +12 -4
- package/components/card/header.js +12 -4
- package/components/card/index.js +12 -4
- package/components/chip/index.js +6 -6
- package/components/form-control/attachment/index.js +197 -192
- package/components/form-control/date-picker/index.js +4 -2
- package/components/form-control/date-range-picker/index.js +15 -8
- package/components/form-control/dropdown/index.js +34 -13
- package/components/form-control/input-base/index.js +505 -483
- package/components/form-control/label/index.js +27 -21
- package/components/form-control/text-input/index.js +4 -1
- package/components/grid/Col.js +8 -7
- package/components/grid/Container.js +16 -15
- package/components/grid/Row.js +16 -15
- package/components/grid/index.js +17 -36
- package/components/image/index.js +164 -0
- package/components/index.js +3 -1
- package/components/modal/body.js +12 -9
- package/components/modal/footer.js +22 -11
- package/components/modal/header.js +25 -13
- package/components/modal/index.js +32 -30
- package/components/modal/modal.js +29 -25
- package/components/others/option-wrapper/index.js +5 -18
- package/components/paging/page-info.js +45 -33
- package/components/paging/page-selector2.js +45 -33
- package/components/popover/body.js +14 -6
- package/components/popover/footer.js +15 -6
- package/components/popover/header.js +17 -7
- package/components/popover/index.js +242 -109
- package/components/status/index.js +12 -4
- package/components/tab/tab-container.js +29 -27
- package/components/tab/tab-header.js +33 -28
- package/components/tab/tab-panel.js +31 -27
- package/components/tab/tab.js +45 -35
- package/components/tree-view/index.js +108 -73
- package/components/typography/index.js +36 -25
- package/icons/basic.js +248 -0
- package/icons/effect.js +44 -36
- package/package.json +1 -1
- package/readme.md +40 -0
- package/styles/general.js +23 -0
- package/theme/index.js +1 -1
- package/theme/set-theme.js +2 -1
- package/utils/index.js +13 -10
- package/utils/useMediaQuery.js +4 -2
|
@@ -5,58 +5,91 @@ import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef } fro
|
|
|
5
5
|
import useInput from '../../../utils/useInput';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { jsx, css } from '@emotion/core';
|
|
8
|
-
import theme from '../../../theme/settings';
|
|
9
|
-
import { typography } from '../../../styles/typography';
|
|
10
|
-
const {
|
|
11
|
-
colors
|
|
12
|
-
} = theme;
|
|
13
8
|
import { getGlobal } from '../../../global';
|
|
14
9
|
import Icon from '../../../icons';
|
|
10
|
+
import { Typography } from '../..';
|
|
11
|
+
import { useTheme } from '../../../theme';
|
|
12
|
+
import { classNames } from '../../../utils';
|
|
13
|
+
import { alignCenter, border, borderBox, borderNone, borderRadius4px, displayBlock, flexRow, outlineNone, parseHeight, parseWidth, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative } from '../../../styles/general';
|
|
14
|
+
const {
|
|
15
|
+
colors: {
|
|
16
|
+
danger,
|
|
17
|
+
info,
|
|
18
|
+
success,
|
|
19
|
+
warning,
|
|
20
|
+
system: {
|
|
21
|
+
active: systemActive,
|
|
22
|
+
white: systemWhite,
|
|
23
|
+
disabled: systemDisabled
|
|
24
|
+
},
|
|
25
|
+
fill: {
|
|
26
|
+
hover: fillHover,
|
|
27
|
+
disabled: fillDisabled
|
|
28
|
+
},
|
|
29
|
+
line: {
|
|
30
|
+
normal: lineNormal,
|
|
31
|
+
hover: lineHover,
|
|
32
|
+
focus: lineFocus,
|
|
33
|
+
disabled: lineDisabled
|
|
34
|
+
},
|
|
35
|
+
text: {
|
|
36
|
+
main: textMain,
|
|
37
|
+
sub: textSub
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
typography: {
|
|
41
|
+
paragraph1
|
|
42
|
+
},
|
|
43
|
+
spacing
|
|
44
|
+
} = useTheme();
|
|
15
45
|
const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
16
|
-
|
|
17
|
-
viewType,
|
|
18
|
-
defaultValue,
|
|
19
|
-
value: valueProp,
|
|
20
|
-
placeholder,
|
|
21
|
-
resize,
|
|
22
|
-
status,
|
|
23
|
-
className,
|
|
46
|
+
action = {},
|
|
24
47
|
autoComplete,
|
|
25
48
|
autoFocus,
|
|
49
|
+
autoWidth,
|
|
50
|
+
className,
|
|
51
|
+
defaultValue,
|
|
52
|
+
delayOnChange,
|
|
26
53
|
disabled,
|
|
27
|
-
readOnly,
|
|
28
|
-
multiline,
|
|
29
|
-
nonStyle,
|
|
30
|
-
refs,
|
|
31
|
-
startIcon,
|
|
32
54
|
endIcon,
|
|
33
|
-
startIconProps,
|
|
34
55
|
endIconProps,
|
|
35
|
-
|
|
36
|
-
inputProps,
|
|
56
|
+
hoverTooltip,
|
|
37
57
|
iconStyle,
|
|
58
|
+
inputProps,
|
|
59
|
+
inputRef: inputBaseRef,
|
|
38
60
|
inputStyle,
|
|
39
|
-
rows,
|
|
40
61
|
maxRows,
|
|
41
|
-
|
|
62
|
+
multiline,
|
|
63
|
+
nonStyle,
|
|
42
64
|
onBlur,
|
|
65
|
+
onChange,
|
|
43
66
|
onFocus,
|
|
44
67
|
onInput,
|
|
45
68
|
onKeyDown,
|
|
46
69
|
onKeyUp,
|
|
47
|
-
|
|
48
|
-
|
|
70
|
+
placeholder,
|
|
71
|
+
readOnly,
|
|
72
|
+
resize,
|
|
73
|
+
rows,
|
|
74
|
+
startIcon,
|
|
75
|
+
startIconProps,
|
|
76
|
+
status,
|
|
77
|
+
type,
|
|
78
|
+
value: valueProp,
|
|
79
|
+
viewType,
|
|
49
80
|
...props
|
|
50
81
|
}, reference) => {
|
|
82
|
+
if (!autoWidth && inputProps !== null && inputProps !== void 0 && inputProps.autoWidth) autoWidth = inputProps.autoWidth;
|
|
83
|
+
|
|
51
84
|
const _onChange = e => {
|
|
52
85
|
onChange && onChange(e);
|
|
53
86
|
dynamicWidth(e);
|
|
54
87
|
};
|
|
55
88
|
|
|
56
89
|
const {
|
|
57
|
-
bind
|
|
90
|
+
bind,
|
|
91
|
+
value
|
|
58
92
|
} = useInput(defaultValue, valueProp, _onChange, onInput, delayOnChange);
|
|
59
|
-
if (!autoWidth && inputProps !== null && inputProps !== void 0 && inputProps.autoWidth) autoWidth = inputProps.autoWidth;
|
|
60
93
|
if (!inputBaseRef) inputBaseRef = useRef(null);
|
|
61
94
|
const ref = useRef(null);
|
|
62
95
|
const valueArray = useRef([]);
|
|
@@ -64,375 +97,19 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
64
97
|
const styleInputBase = useRef(null);
|
|
65
98
|
const widthInit = useRef(null);
|
|
66
99
|
const isEnabled = !readOnly && !disabled;
|
|
67
|
-
/* Start styled */
|
|
68
|
-
|
|
69
|
-
const inputBaseRoot = css`
|
|
70
|
-
display: flex;
|
|
71
|
-
flex: 1 1 auto;
|
|
72
|
-
align-items: center;
|
|
73
|
-
position: relative;
|
|
74
|
-
height: max-content;
|
|
75
|
-
width: ${autoWidth ? 'max-content' : 'auto'};
|
|
76
|
-
&:hover,
|
|
77
|
-
&:focus-within {
|
|
78
|
-
.start-icon:not(.non-effect) {
|
|
79
|
-
path {
|
|
80
|
-
fill: ${colors.primary};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
&:focus-within {
|
|
85
|
-
border-bottom-color: ${colors.info5};
|
|
86
|
-
&::after {
|
|
87
|
-
border-bottom-color: inherit;
|
|
88
|
-
transform: scaleX(1);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
&.underlined {
|
|
92
|
-
padding-bottom: 4px;
|
|
93
|
-
padding-top: 4px;
|
|
94
|
-
&:not(:focus-within):hover {
|
|
95
|
-
&::before {
|
|
96
|
-
${!readOnly && `border-bottom-color: ${colors.brand}`};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
&:focus-within {
|
|
100
|
-
${!readOnly && `
|
|
101
|
-
border-bottom-color: ${colors.info5};
|
|
102
|
-
&::after {
|
|
103
|
-
border-bottom-color: inherit;
|
|
104
|
-
transform: scaleX(1);
|
|
105
|
-
}
|
|
106
|
-
`}
|
|
107
|
-
}
|
|
108
|
-
&::before {
|
|
109
|
-
content: '';
|
|
110
|
-
position: absolute;
|
|
111
|
-
left: 0;
|
|
112
|
-
right: 0;
|
|
113
|
-
bottom: 0;
|
|
114
|
-
border-bottom: 1px solid ${colors.border};
|
|
115
|
-
}
|
|
116
|
-
&::after {
|
|
117
|
-
content: '';
|
|
118
|
-
position: absolute;
|
|
119
|
-
left: 0px;
|
|
120
|
-
right: 0px;
|
|
121
|
-
bottom: -1px;
|
|
122
|
-
border-bottom: 2px solid transparent;
|
|
123
|
-
transform: scaleX(0);
|
|
124
|
-
transform-origin: center;
|
|
125
|
-
transition: all 0.2s ease;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
&.outlined {
|
|
129
|
-
border: 1px solid ${colors.border};
|
|
130
|
-
border-radius: 4px;
|
|
131
|
-
height: 40px;
|
|
132
|
-
box-sizing: border-box;
|
|
133
|
-
background-color: ${colors.white};
|
|
134
|
-
&:not(:focus-within):hover {
|
|
135
|
-
${!readOnly && `
|
|
136
|
-
background-color: ${colors.hover};
|
|
137
|
-
border-color: ${colors.brand};
|
|
138
|
-
input {
|
|
139
|
-
background-color: ${colors.hover};
|
|
140
|
-
}
|
|
141
|
-
`};
|
|
142
|
-
}
|
|
143
|
-
&:focus-within {
|
|
144
|
-
${!readOnly && `
|
|
145
|
-
border-color: ${colors.info5};
|
|
146
|
-
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
147
|
-
&::after {
|
|
148
|
-
border-color: inherit;
|
|
149
|
-
}
|
|
150
|
-
`}
|
|
151
|
-
}
|
|
152
|
-
&::after {
|
|
153
|
-
content: '';
|
|
154
|
-
position: absolute;
|
|
155
|
-
left: -2px;
|
|
156
|
-
right: -2px;
|
|
157
|
-
top: -2px;
|
|
158
|
-
bottom: -2px;
|
|
159
|
-
border: 2px solid transparent;
|
|
160
|
-
border-radius: 4px;
|
|
161
|
-
pointer-events: none;
|
|
162
|
-
}
|
|
163
|
-
.start-icon {
|
|
164
|
-
margin-left: 16px;
|
|
165
|
-
}
|
|
166
|
-
.end-icon {
|
|
167
|
-
margin-right: 16px;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
&.non-style {
|
|
171
|
-
border-color: transparent !important;
|
|
172
|
-
box-shadow: none !important;
|
|
173
|
-
background-color: transparent !important;
|
|
174
|
-
input {
|
|
175
|
-
background-color: transparent !important;
|
|
176
|
-
}
|
|
177
|
-
&:before,
|
|
178
|
-
&:after {
|
|
179
|
-
border-color: transparent !important;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
&.info {
|
|
183
|
-
border-color: ${colors.info} !important;
|
|
184
|
-
&::before {
|
|
185
|
-
border-color: ${colors.info} !important;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
&.success {
|
|
189
|
-
border-color: ${colors.success} !important;
|
|
190
|
-
&::before {
|
|
191
|
-
border-color: ${colors.success} !important;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
&.warning {
|
|
195
|
-
border-color: ${colors.warning} !important;
|
|
196
|
-
&::before {
|
|
197
|
-
border-color: ${colors.warning} !important;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
&.danger {
|
|
201
|
-
border-color: ${colors.danger} !important;
|
|
202
|
-
&::before {
|
|
203
|
-
border-color: ${colors.danger} !important;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
&.disabled {
|
|
207
|
-
border-color: ${colors.disabled} !important;
|
|
208
|
-
pointer-events: none;
|
|
209
|
-
&::before {
|
|
210
|
-
border-bottom-color: ${colors.disabled} !important;
|
|
211
|
-
}
|
|
212
|
-
&.outlined {
|
|
213
|
-
background-color: ${colors.dark12};
|
|
214
|
-
}
|
|
215
|
-
/* input {
|
|
216
|
-
color: ${colors.disabled};
|
|
217
|
-
} */
|
|
218
|
-
.start-icon,
|
|
219
|
-
.end-icon {
|
|
220
|
-
&:not(.non-effect),
|
|
221
|
-
&.allow-disabled {
|
|
222
|
-
path {
|
|
223
|
-
fill: ${colors.disabled};
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
& + .DGN-UI-HelperText {
|
|
229
|
-
min-height: 16px;
|
|
230
|
-
position: absolute;
|
|
231
|
-
top: 100%;
|
|
232
|
-
}
|
|
233
|
-
`;
|
|
234
|
-
const inputBaseCSS = css`
|
|
235
|
-
display: flex;
|
|
236
|
-
flex: 1 1 auto;
|
|
237
|
-
`;
|
|
238
|
-
const inputCSS = css`
|
|
239
|
-
width: ${autoWidth ? '10px' : '100%'};
|
|
240
|
-
border: none;
|
|
241
|
-
outline: none;
|
|
242
|
-
transition: all 0.1s;
|
|
243
|
-
color: ${colors.input};
|
|
244
|
-
background-color: transparent;
|
|
245
|
-
padding-top: 0;
|
|
246
|
-
${typography.paragraph1};
|
|
247
|
-
height: 24px;
|
|
248
|
-
text-overflow: ellipsis;
|
|
249
|
-
&::placeholder {
|
|
250
|
-
color: ${colors.placeholder};
|
|
251
|
-
${typography.paragraph1};
|
|
252
|
-
}
|
|
253
|
-
&:focus {
|
|
254
|
-
background-color: transparent;
|
|
255
|
-
color: ${colors.primary};
|
|
256
|
-
}
|
|
257
|
-
&:hover {
|
|
258
|
-
color: ${colors.primary};
|
|
259
|
-
}
|
|
260
|
-
&.outlined {
|
|
261
|
-
padding-bottom: inherit;
|
|
262
|
-
padding-left: 16px;
|
|
263
|
-
padding-right: 16px;
|
|
264
|
-
}
|
|
265
|
-
&.underlined {
|
|
266
|
-
padding-bottom: 0;
|
|
267
|
-
padding-left: 0;
|
|
268
|
-
padding-right: 0;
|
|
269
|
-
}
|
|
270
|
-
&:disabled {
|
|
271
|
-
background-color: transparent;
|
|
272
|
-
}
|
|
273
|
-
`;
|
|
274
|
-
const textAreaCSS = css`
|
|
275
|
-
display: block;
|
|
276
|
-
color: ${colors.input};
|
|
277
|
-
${typography.paragraph1};
|
|
278
|
-
min-height: max-content;
|
|
279
|
-
min-width: max-content;
|
|
280
|
-
outline: none;
|
|
281
|
-
border: none;
|
|
282
|
-
background-color: transparent;
|
|
283
|
-
padding: 2px 0;
|
|
284
|
-
width: 100%;
|
|
285
|
-
overflow-y: auto;
|
|
286
|
-
position: relative;
|
|
287
|
-
resize: ${resize};
|
|
288
|
-
box-sizing: border-box;
|
|
289
|
-
/* &:disabled {
|
|
290
|
-
color: ${colors.disabled};
|
|
291
|
-
} */
|
|
292
|
-
&:hover:not(:focus-within) {
|
|
293
|
-
${!readOnly && `
|
|
294
|
-
border-color: ${colors.brand};
|
|
295
|
-
color: ${colors.primary};
|
|
296
|
-
::placeholder {
|
|
297
|
-
color: ${colors.primary};
|
|
298
|
-
}
|
|
299
|
-
`};
|
|
300
|
-
}
|
|
301
|
-
&:focus-within {
|
|
302
|
-
color: ${colors.primary};
|
|
303
|
-
}
|
|
304
|
-
&::-webkit-scrollbar {
|
|
305
|
-
width: 4px;
|
|
306
|
-
background-color: white;
|
|
307
|
-
border-radius: 4px;
|
|
308
|
-
}
|
|
309
|
-
&::-webkit-scrollbar-thumb {
|
|
310
|
-
border-radius: 10px;
|
|
311
|
-
mix-blend-mode: normal;
|
|
312
|
-
background-color: ${colors.dark12};
|
|
313
|
-
background-clip: content-box;
|
|
314
|
-
}
|
|
315
|
-
`;
|
|
316
|
-
const multilineCSS = css`
|
|
317
|
-
display: block;
|
|
318
|
-
position: relative;
|
|
319
|
-
height: max-content;
|
|
320
|
-
width: 100%;
|
|
321
|
-
box-sizing: border-box;
|
|
322
|
-
&.outlined {
|
|
323
|
-
border: 1px solid ${colors.border};
|
|
324
|
-
border-radius: 4px;
|
|
325
|
-
/* height: 30px; */
|
|
326
|
-
padding: 7px 16px;
|
|
327
|
-
.css-${textAreaCSS.name} {
|
|
328
|
-
height: 24px;
|
|
329
|
-
}
|
|
330
|
-
&:not(:focus-within):hover {
|
|
331
|
-
${!readOnly && `
|
|
332
|
-
background-color: ${colors.hover};
|
|
333
|
-
border-color: ${colors.brand};
|
|
334
|
-
input {
|
|
335
|
-
background-color: ${colors.hover};
|
|
336
|
-
}
|
|
337
|
-
`};
|
|
338
|
-
}
|
|
339
|
-
&:focus-within {
|
|
340
|
-
${!readOnly && `
|
|
341
|
-
border-color: ${colors.info5};
|
|
342
|
-
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
343
|
-
&::after {
|
|
344
|
-
border-color: inherit;
|
|
345
|
-
}
|
|
346
|
-
`}
|
|
347
|
-
}
|
|
348
|
-
&::after {
|
|
349
|
-
content: '';
|
|
350
|
-
position: absolute;
|
|
351
|
-
left: -2px;
|
|
352
|
-
right: -2px;
|
|
353
|
-
top: -2px;
|
|
354
|
-
bottom: -2px;
|
|
355
|
-
border: 2px solid transparent;
|
|
356
|
-
border-radius: 4px;
|
|
357
|
-
pointer-events: none;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
&.underlined {
|
|
361
|
-
border: 0;
|
|
362
|
-
/* height: 26px; */
|
|
363
|
-
padding: 4px 0;
|
|
364
|
-
.css-${textAreaCSS.name} {
|
|
365
|
-
height: 24px;
|
|
366
|
-
}
|
|
367
|
-
&:not(:focus-within):hover {
|
|
368
|
-
${!readOnly && `
|
|
369
|
-
&::before {
|
|
370
|
-
border-bottom-color: ${colors.brand};
|
|
371
|
-
}
|
|
372
|
-
`};
|
|
373
|
-
}
|
|
374
|
-
&:focus-within {
|
|
375
|
-
${!readOnly && `
|
|
376
|
-
&::after {
|
|
377
|
-
border-bottom-color: ${colors.info5};
|
|
378
|
-
transform: scaleX(1);
|
|
379
|
-
}
|
|
380
|
-
`}
|
|
381
|
-
}
|
|
382
|
-
&::before {
|
|
383
|
-
content: '';
|
|
384
|
-
position: absolute;
|
|
385
|
-
left: 0;
|
|
386
|
-
right: 0;
|
|
387
|
-
bottom: 0;
|
|
388
|
-
border-bottom: 1px solid ${colors.border};
|
|
389
|
-
}
|
|
390
|
-
&::after {
|
|
391
|
-
content: '';
|
|
392
|
-
position: absolute;
|
|
393
|
-
left: 0px;
|
|
394
|
-
right: 0px;
|
|
395
|
-
bottom: -1px;
|
|
396
|
-
border-bottom: 2px solid transparent;
|
|
397
|
-
transform: scaleX(0);
|
|
398
|
-
transform-origin: center;
|
|
399
|
-
transition: all 0.2s ease;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
&.disabled {
|
|
403
|
-
pointer-events: none;
|
|
404
|
-
resize: none;
|
|
405
|
-
/* color: ${colors.disabled}; */
|
|
406
|
-
&.outlined {
|
|
407
|
-
background-color: ${colors.dark12};
|
|
408
|
-
}
|
|
409
|
-
&.underlined::before {
|
|
410
|
-
border-bottom-color: ${colors.disabled} !important;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
& + .DGN-UI-HelperText {
|
|
414
|
-
min-height: 16px;
|
|
415
|
-
position: absolute;
|
|
416
|
-
top: 100%;
|
|
417
|
-
}
|
|
418
|
-
`;
|
|
419
|
-
const inputBaseIconCSS = css`
|
|
420
|
-
display: flex;
|
|
421
|
-
color: inherit;
|
|
422
|
-
&.start-icon {
|
|
423
|
-
margin-right: 4px;
|
|
424
|
-
& + input {
|
|
425
|
-
padding-left: 0;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
&.end-icon {
|
|
429
|
-
margin-left: 4px;
|
|
430
|
-
}
|
|
431
|
-
`;
|
|
432
|
-
/* End styled */
|
|
433
100
|
|
|
101
|
+
const _InputBaseRootCSS = InputBaseRootCSS(autoWidth, readOnly);
|
|
102
|
+
|
|
103
|
+
const _InputCSS = InputCSS(autoWidth, isEnabled, hoverTooltip, endIcon);
|
|
104
|
+
|
|
105
|
+
const _TypoCSS = TypoCSS(disabled);
|
|
106
|
+
|
|
107
|
+
const _TextAreaCSS = TextAreaCSS(resize, readOnly);
|
|
108
|
+
|
|
109
|
+
const _MultilineCSS = MultilineCSS(_TextAreaCSS.name, readOnly, rows, maxRows);
|
|
434
110
|
/* Start handler */
|
|
435
111
|
|
|
112
|
+
|
|
436
113
|
const onInputTextArea = e => {
|
|
437
114
|
if (!/\d+/.test(rows)) {
|
|
438
115
|
const el = e.target;
|
|
@@ -450,8 +127,6 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
450
127
|
};
|
|
451
128
|
|
|
452
129
|
useEffect(() => {
|
|
453
|
-
!!refs && refs(ref);
|
|
454
|
-
|
|
455
130
|
if (defaultValue !== undefined && defaultValue !== '') {
|
|
456
131
|
if (multiline && !/\d+/.test(rows)) {
|
|
457
132
|
inputBaseRef.current.style.height = 0;
|
|
@@ -459,36 +134,6 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
459
134
|
}
|
|
460
135
|
}
|
|
461
136
|
}, []);
|
|
462
|
-
useEffect(() => {
|
|
463
|
-
if (/\d+/.test(rows)) {
|
|
464
|
-
inputBaseRef.current.style.height = 20 * rows + 4 + 'px';
|
|
465
|
-
return () => {
|
|
466
|
-
if (inputBaseRef.current) {
|
|
467
|
-
inputBaseRef.current.style.height = null;
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
}, [rows]);
|
|
472
|
-
useEffect(() => {
|
|
473
|
-
if (/\d+/.test(maxRows)) {
|
|
474
|
-
inputBaseRef.current.style.maxHeight = 20 * maxRows + 4 + 'px';
|
|
475
|
-
return () => {
|
|
476
|
-
if (inputBaseRef.current) {
|
|
477
|
-
inputBaseRef.current.style.maxHeight = null;
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
}, [maxRows]);
|
|
482
|
-
useEffect(() => {
|
|
483
|
-
if (viewType === 'outlined' && endIcon) {
|
|
484
|
-
inputBaseRef.current.style.paddingRight = '0';
|
|
485
|
-
return () => {
|
|
486
|
-
if (inputBaseRef.current) {
|
|
487
|
-
inputBaseRef.current.style.paddingRight = null;
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
}, [viewType]);
|
|
492
137
|
useEffect(() => {
|
|
493
138
|
if (multiline && !/\d+/.test(rows) && !(inputBaseRef.current.value || inputBaseRef.current.value === 0)) {
|
|
494
139
|
inputBaseRef.current.style.height = '24px';
|
|
@@ -497,12 +142,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
497
142
|
if (autoFocus) {
|
|
498
143
|
inputBaseRef.current.focus();
|
|
499
144
|
}
|
|
500
|
-
}, [multiline]);
|
|
501
|
-
// if (placeholder !== undefined) {
|
|
502
|
-
// inputBaseRef.current.placeholder = placeholder;
|
|
503
|
-
// }
|
|
504
|
-
// }, [placeholder]);
|
|
505
|
-
|
|
145
|
+
}, [multiline]);
|
|
506
146
|
useEffect(() => {
|
|
507
147
|
const defaultHeight = 24;
|
|
508
148
|
|
|
@@ -528,24 +168,20 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
528
168
|
}
|
|
529
169
|
};
|
|
530
170
|
}, [valueProp]);
|
|
531
|
-
|
|
532
|
-
if (disabled) {
|
|
533
|
-
if (ref.current) {
|
|
534
|
-
ref.current.classList.add('disabled');
|
|
535
|
-
}
|
|
171
|
+
/* End handler */
|
|
536
172
|
|
|
537
|
-
|
|
538
|
-
}
|
|
173
|
+
useImperativeHandle(reference, () => {
|
|
174
|
+
const currentRef = inputBaseRef.current || {};
|
|
175
|
+
const _instance = { ...action
|
|
176
|
+
}; // methods
|
|
539
177
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
/* End handler */
|
|
178
|
+
_instance.__proto__ = {}; // hidden methods
|
|
179
|
+
|
|
180
|
+
currentRef.instance = _instance;
|
|
181
|
+
return currentRef;
|
|
182
|
+
});
|
|
546
183
|
|
|
547
184
|
const saveInitInfo = refs => {
|
|
548
|
-
inputBaseRef.current = refs;
|
|
549
185
|
if (!autoWidth) return;
|
|
550
186
|
const style = window.getComputedStyle(refs) || refs.currentStyle;
|
|
551
187
|
if (!widthInit.current) widthInit.current = parseInt(style.width);
|
|
@@ -567,25 +203,25 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
567
203
|
|
|
568
204
|
const newClass = (viewType === 'outlined' ? 'outlined' : 'underlined') + (nonStyle ? ' non-style' : '');
|
|
569
205
|
const MultipleInputComp = jsx("div", {
|
|
570
|
-
css:
|
|
571
|
-
className:
|
|
206
|
+
css: _MultilineCSS,
|
|
207
|
+
className: classNames('DGN-UI-InputBase', newClass, className, disabled && 'disabled'),
|
|
572
208
|
ref: ref,
|
|
573
209
|
...props
|
|
574
210
|
}, jsx("textarea", {
|
|
575
|
-
type: "text",
|
|
576
211
|
placeholder: isEnabled ? placeholder : '',
|
|
577
212
|
defaultValue: defaultValue,
|
|
578
213
|
...inputProps,
|
|
579
|
-
css:
|
|
214
|
+
css: _TextAreaCSS,
|
|
580
215
|
readOnly: readOnly,
|
|
581
216
|
style: inputStyle || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.style),
|
|
582
|
-
className: inputProps.className
|
|
217
|
+
className: classNames(inputProps.className),
|
|
583
218
|
ref: inputBaseRef,
|
|
584
219
|
onKeyDown: onKeyDown,
|
|
585
220
|
onKeyUp: onKeyUp,
|
|
586
221
|
onInput: onInputTextArea,
|
|
587
222
|
onBlur: onBlur,
|
|
588
223
|
onFocus: onFocus,
|
|
224
|
+
disabled: disabled,
|
|
589
225
|
...bind
|
|
590
226
|
}));
|
|
591
227
|
const StartIcon = useMemo(() => {
|
|
@@ -599,9 +235,9 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
599
235
|
}
|
|
600
236
|
|
|
601
237
|
return jsx("div", {
|
|
602
|
-
css:
|
|
238
|
+
css: InputBaseIconCSS,
|
|
603
239
|
...startIconProps,
|
|
604
|
-
className:
|
|
240
|
+
className: classNames('start-icon', startIconProps.className)
|
|
605
241
|
}, node);
|
|
606
242
|
}, [startIcon]);
|
|
607
243
|
const EndIcon = useMemo(() => {
|
|
@@ -615,18 +251,18 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
615
251
|
}
|
|
616
252
|
|
|
617
253
|
return jsx("div", {
|
|
618
|
-
css:
|
|
254
|
+
css: InputBaseIconCSS,
|
|
619
255
|
...endIconProps,
|
|
620
|
-
className:
|
|
256
|
+
className: classNames('end-icon', endIconProps.className)
|
|
621
257
|
}, ' ', node, ' ');
|
|
622
258
|
}, [endIcon]);
|
|
623
259
|
const InputComp = jsx("div", {
|
|
624
|
-
css:
|
|
260
|
+
css: _InputBaseRootCSS,
|
|
625
261
|
ref: ref,
|
|
626
262
|
...props,
|
|
627
|
-
className:
|
|
263
|
+
className: classNames('DGN-UI-InputBase', newClass, className, status, disabled && 'disabled')
|
|
628
264
|
}, startIcon && StartIcon, jsx("div", {
|
|
629
|
-
css:
|
|
265
|
+
css: InputBaseCSS
|
|
630
266
|
}, jsx("input", {
|
|
631
267
|
type: type,
|
|
632
268
|
autoComplete: autoComplete,
|
|
@@ -635,53 +271,439 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
635
271
|
...inputProps,
|
|
636
272
|
readOnly: readOnly,
|
|
637
273
|
style: inputStyle || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.style),
|
|
638
|
-
className:
|
|
274
|
+
className: classNames(newClass, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className),
|
|
639
275
|
ref: refs => {
|
|
640
276
|
if (!refs) return;
|
|
277
|
+
inputBaseRef.current = refs;
|
|
641
278
|
saveInitInfo(refs);
|
|
642
279
|
},
|
|
643
|
-
css:
|
|
280
|
+
css: _InputCSS,
|
|
644
281
|
onKeyDown: onKeyDown,
|
|
645
282
|
onKeyUp: onKeyUp,
|
|
646
283
|
onInput: onInput,
|
|
647
284
|
onBlur: onBlur,
|
|
648
285
|
onFocus: onFocus,
|
|
286
|
+
disabled: disabled,
|
|
649
287
|
...bind
|
|
650
|
-
})
|
|
651
|
-
|
|
288
|
+
}), !isEnabled && hoverTooltip && jsx(Typography, {
|
|
289
|
+
css: _TypoCSS,
|
|
290
|
+
className: classNames(newClass, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className),
|
|
291
|
+
lineClamp: 1,
|
|
292
|
+
hoverTooltip: true,
|
|
293
|
+
type: 'p1',
|
|
294
|
+
style: {
|
|
295
|
+
lineHeight: '24px'
|
|
296
|
+
}
|
|
297
|
+
}, value !== null && value !== void 0 ? value : '')), endIcon && EndIcon);
|
|
652
298
|
/* End component */
|
|
653
299
|
|
|
654
|
-
|
|
655
|
-
const currentRef = inputBaseRef.current || {};
|
|
656
|
-
const _instance = {}; // methods
|
|
657
|
-
|
|
658
|
-
_instance.__proto__ = {}; // hidden methods
|
|
659
|
-
|
|
660
|
-
currentRef.instance = _instance;
|
|
661
|
-
return currentRef;
|
|
662
|
-
});
|
|
663
|
-
return InputBaseComp;
|
|
300
|
+
return multiline ? MultipleInputComp : InputComp;
|
|
664
301
|
}));
|
|
302
|
+
|
|
303
|
+
const InputBaseRootCSS = (autoWidth, readOnly) => css`
|
|
304
|
+
${flexRow};
|
|
305
|
+
${alignCenter};
|
|
306
|
+
${positionRelative};
|
|
307
|
+
${parseWidthHeight(autoWidth ? 'max-content' : 'auto', 'max-content')}
|
|
308
|
+
flex: 1 1 auto;
|
|
309
|
+
&:hover,
|
|
310
|
+
&:focus-within {
|
|
311
|
+
.start-icon:not(.non-effect) {
|
|
312
|
+
path {
|
|
313
|
+
fill: ${systemActive};
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
&:focus-within {
|
|
318
|
+
border-bottom-color: ${info};
|
|
319
|
+
&::after {
|
|
320
|
+
border-bottom-color: inherit;
|
|
321
|
+
transform: scaleX(1);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
&.underlined {
|
|
325
|
+
padding-bottom: ${spacing([1])};
|
|
326
|
+
padding-top: ${spacing([1])};
|
|
327
|
+
&:not(:focus-within):hover {
|
|
328
|
+
&::before {
|
|
329
|
+
${!readOnly && `border-bottom-color: ${lineHover}`};
|
|
330
|
+
}
|
|
331
|
+
input {
|
|
332
|
+
::placeholder {
|
|
333
|
+
color: ${systemActive};
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
&:focus-within {
|
|
338
|
+
${!readOnly && `
|
|
339
|
+
border-bottom-color: ${lineFocus};
|
|
340
|
+
&::after {
|
|
341
|
+
border-bottom-color: inherit;
|
|
342
|
+
transform: scaleX(1);
|
|
343
|
+
}
|
|
344
|
+
`}
|
|
345
|
+
}
|
|
346
|
+
&::before {
|
|
347
|
+
content: '';
|
|
348
|
+
${positionAbsolute};
|
|
349
|
+
left: 0;
|
|
350
|
+
right: 0;
|
|
351
|
+
bottom: 0;
|
|
352
|
+
border-bottom: 1px solid ${lineNormal};
|
|
353
|
+
}
|
|
354
|
+
&::after {
|
|
355
|
+
content: '';
|
|
356
|
+
${positionAbsolute};
|
|
357
|
+
left: 0px;
|
|
358
|
+
right: 0px;
|
|
359
|
+
bottom: -1px;
|
|
360
|
+
border-bottom: 2px solid transparent;
|
|
361
|
+
transform: scaleX(0);
|
|
362
|
+
transform-origin: center;
|
|
363
|
+
transition: all 0.2s ease;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
&.outlined {
|
|
367
|
+
${border(1, lineNormal)};
|
|
368
|
+
${borderRadius4px};
|
|
369
|
+
${parseHeight(40)};
|
|
370
|
+
${borderBox};
|
|
371
|
+
background-color: ${systemWhite};
|
|
372
|
+
&:not(:focus-within):hover {
|
|
373
|
+
${!readOnly && `
|
|
374
|
+
background-color: ${fillHover};
|
|
375
|
+
border-color: ${lineHover};
|
|
376
|
+
input {
|
|
377
|
+
::placeholder {
|
|
378
|
+
color: ${systemActive};
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
`};
|
|
383
|
+
}
|
|
384
|
+
&:focus-within {
|
|
385
|
+
${!readOnly && `
|
|
386
|
+
border-color: ${lineFocus};
|
|
387
|
+
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
388
|
+
&::after {
|
|
389
|
+
border-color: inherit;
|
|
390
|
+
}
|
|
391
|
+
`}
|
|
392
|
+
}
|
|
393
|
+
&::after {
|
|
394
|
+
content: '';
|
|
395
|
+
${positionAbsolute};
|
|
396
|
+
${border(2, 'transparent')};
|
|
397
|
+
${borderRadius4px};
|
|
398
|
+
${pointerEventsNone};
|
|
399
|
+
left: -2px;
|
|
400
|
+
right: -2px;
|
|
401
|
+
top: -2px;
|
|
402
|
+
bottom: -2px;
|
|
403
|
+
}
|
|
404
|
+
.start-icon {
|
|
405
|
+
margin-left: ${spacing([4])};
|
|
406
|
+
}
|
|
407
|
+
.end-icon {
|
|
408
|
+
margin-right: ${spacing([4])};
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
&.non-style {
|
|
412
|
+
border-color: transparent !important;
|
|
413
|
+
box-shadow: none !important;
|
|
414
|
+
background-color: transparent !important;
|
|
415
|
+
input {
|
|
416
|
+
background-color: transparent !important;
|
|
417
|
+
}
|
|
418
|
+
&:before,
|
|
419
|
+
&:after {
|
|
420
|
+
border-color: transparent !important;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
&.info {
|
|
424
|
+
border-color: ${info} !important;
|
|
425
|
+
&::before {
|
|
426
|
+
border-color: ${info} !important;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
&.success {
|
|
430
|
+
border-color: ${success} !important;
|
|
431
|
+
&::before {
|
|
432
|
+
border-color: ${success} !important;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
&.warning {
|
|
436
|
+
border-color: ${warning} !important;
|
|
437
|
+
&::before {
|
|
438
|
+
border-color: ${warning} !important;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
&.danger {
|
|
442
|
+
border-color: ${danger} !important;
|
|
443
|
+
&::before {
|
|
444
|
+
border-color: ${danger} !important;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
&.disabled {
|
|
448
|
+
${pointerEventsNone};
|
|
449
|
+
border-color: ${lineDisabled} !important;
|
|
450
|
+
&::before {
|
|
451
|
+
border-bottom-color: ${lineDisabled} !important;
|
|
452
|
+
}
|
|
453
|
+
&.outlined {
|
|
454
|
+
background-color: ${fillDisabled};
|
|
455
|
+
}
|
|
456
|
+
.start-icon,
|
|
457
|
+
.end-icon {
|
|
458
|
+
&:not(.non-effect),
|
|
459
|
+
&.allow-disabled {
|
|
460
|
+
path {
|
|
461
|
+
fill: ${systemDisabled};
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
& + .DGN-UI-HelperText {
|
|
467
|
+
${positionAbsolute};
|
|
468
|
+
min-height: 16px;
|
|
469
|
+
top: 100%;
|
|
470
|
+
}
|
|
471
|
+
`;
|
|
472
|
+
|
|
473
|
+
const InputBaseCSS = css`
|
|
474
|
+
${flexRow};
|
|
475
|
+
flex: 1 1 auto;
|
|
476
|
+
`;
|
|
477
|
+
|
|
478
|
+
const InputCSS = (autoWidth, isEnabled, hoverTooltip, endIcon) => css`
|
|
479
|
+
${parseWidthHeight(autoWidth ? '10px' : '100%', 24)};
|
|
480
|
+
${borderNone};
|
|
481
|
+
${outlineNone};
|
|
482
|
+
transition: all 0.1s;
|
|
483
|
+
color: ${textMain};
|
|
484
|
+
background-color: transparent;
|
|
485
|
+
padding-top: 0;
|
|
486
|
+
${paragraph1};
|
|
487
|
+
text-overflow: ellipsis;
|
|
488
|
+
&::placeholder {
|
|
489
|
+
color: ${textSub};
|
|
490
|
+
${paragraph1};
|
|
491
|
+
}
|
|
492
|
+
&:focus {
|
|
493
|
+
background-color: transparent;
|
|
494
|
+
color: ${systemActive};
|
|
495
|
+
}
|
|
496
|
+
&:hover {
|
|
497
|
+
color: ${systemActive};
|
|
498
|
+
}
|
|
499
|
+
&.outlined {
|
|
500
|
+
padding-bottom: inherit;
|
|
501
|
+
padding-left: ${spacing([4])};
|
|
502
|
+
padding-right: ${endIcon ? 0 : spacing([4])};
|
|
503
|
+
}
|
|
504
|
+
&.underlined {
|
|
505
|
+
padding-bottom: 0;
|
|
506
|
+
padding-left: 0;
|
|
507
|
+
padding-right: 0;
|
|
508
|
+
}
|
|
509
|
+
&:disabled {
|
|
510
|
+
background-color: transparent;
|
|
511
|
+
}
|
|
512
|
+
${!isEnabled && hoverTooltip && 'display: none'};
|
|
513
|
+
`;
|
|
514
|
+
|
|
515
|
+
const TypoCSS = disabled => css`
|
|
516
|
+
${parseHeight(24)};
|
|
517
|
+
&.outlined {
|
|
518
|
+
padding-bottom: inherit;
|
|
519
|
+
padding-left: ${spacing([4])};
|
|
520
|
+
padding-right: ${spacing([4])};
|
|
521
|
+
}
|
|
522
|
+
&:focus {
|
|
523
|
+
background-color: transparent;
|
|
524
|
+
color: ${systemActive};
|
|
525
|
+
}
|
|
526
|
+
&:hover {
|
|
527
|
+
color: ${systemActive};
|
|
528
|
+
}
|
|
529
|
+
${disabled && 'user-select: none'};
|
|
530
|
+
`;
|
|
531
|
+
|
|
532
|
+
const TextAreaCSS = (resize, readOnly) => css`
|
|
533
|
+
${displayBlock};
|
|
534
|
+
color: ${textMain};
|
|
535
|
+
${paragraph1};
|
|
536
|
+
${borderNone};
|
|
537
|
+
${outlineNone};
|
|
538
|
+
${positionRelative};
|
|
539
|
+
${borderBox};
|
|
540
|
+
${parseWidth('100%')};
|
|
541
|
+
min-height: max-content;
|
|
542
|
+
min-width: max-content;
|
|
543
|
+
background-color: transparent;
|
|
544
|
+
padding: ${spacing(0.5, 0)};
|
|
545
|
+
overflow-y: auto;
|
|
546
|
+
resize: ${resize};
|
|
547
|
+
&:hover:not(:focus-within) {
|
|
548
|
+
${!readOnly && `
|
|
549
|
+
border-color: ${systemActive};
|
|
550
|
+
color: ${systemActive};
|
|
551
|
+
::placeholder {
|
|
552
|
+
color: ${systemActive};
|
|
553
|
+
}
|
|
554
|
+
`};
|
|
555
|
+
}
|
|
556
|
+
&:focus-within {
|
|
557
|
+
color: ${systemActive};
|
|
558
|
+
}
|
|
559
|
+
&::-webkit-scrollbar {
|
|
560
|
+
${borderRadius4px};
|
|
561
|
+
${parseWidth(4)};
|
|
562
|
+
background-color: ${systemWhite};
|
|
563
|
+
}
|
|
564
|
+
&::-webkit-scrollbar-thumb {
|
|
565
|
+
border-radius: 10px;
|
|
566
|
+
mix-blend-mode: normal;
|
|
567
|
+
background-color: ${fillDisabled};
|
|
568
|
+
background-clip: content-box;
|
|
569
|
+
}
|
|
570
|
+
`;
|
|
571
|
+
|
|
572
|
+
const MultilineCSS = (TextAreaCSSName, readOnly, rows, maxRows) => css`
|
|
573
|
+
${displayBlock};
|
|
574
|
+
${positionRelative};
|
|
575
|
+
${borderBox};
|
|
576
|
+
${parseWidthHeight('100%', 'max-content')};
|
|
577
|
+
&.outlined {
|
|
578
|
+
${border(1, lineNormal)};
|
|
579
|
+
${borderRadius4px};
|
|
580
|
+
padding: ${spacing([1.75, 4])};
|
|
581
|
+
.css-${TextAreaCSSName} {
|
|
582
|
+
${parseHeight(24)};
|
|
583
|
+
${rows && /\d+/.test(rows) && `height: ${20 * rows + 4}px`};
|
|
584
|
+
${maxRows && /\d+/.test(maxRows) && `max-height: ${20 * maxRows + 4}px`};
|
|
585
|
+
}
|
|
586
|
+
&:not(:focus-within):hover {
|
|
587
|
+
${!readOnly && `
|
|
588
|
+
background-color: ${fillHover};
|
|
589
|
+
border-color: ${lineHover};
|
|
590
|
+
`};
|
|
591
|
+
}
|
|
592
|
+
&:focus-within {
|
|
593
|
+
${!readOnly && `
|
|
594
|
+
border-color: ${lineFocus};
|
|
595
|
+
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
596
|
+
&::after {
|
|
597
|
+
border-color: inherit;
|
|
598
|
+
}
|
|
599
|
+
`}
|
|
600
|
+
}
|
|
601
|
+
&::after {
|
|
602
|
+
content: '';
|
|
603
|
+
${positionAbsolute};
|
|
604
|
+
${borderRadius4px};
|
|
605
|
+
${pointerEventsNone};
|
|
606
|
+
${border(2, 'transparent')}
|
|
607
|
+
left: -2px;
|
|
608
|
+
right: -2px;
|
|
609
|
+
top: -2px;
|
|
610
|
+
bottom: -2px;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
&.underlined {
|
|
614
|
+
border: 0;
|
|
615
|
+
padding: ${spacing(1, 0)};
|
|
616
|
+
.css-${TextAreaCSSName} {
|
|
617
|
+
${parseHeight(24)};
|
|
618
|
+
${rows && /\d+/.test(rows) && `height: ${20 * rows + 4}px`};
|
|
619
|
+
${maxRows && /\d+/.test(maxRows) && `max-height: ${20 * maxRows + 4}px`};
|
|
620
|
+
}
|
|
621
|
+
&:not(:focus-within):hover {
|
|
622
|
+
${!readOnly && `
|
|
623
|
+
&::before {
|
|
624
|
+
border-bottom-color: ${lineHover};
|
|
625
|
+
}
|
|
626
|
+
`};
|
|
627
|
+
}
|
|
628
|
+
&:focus-within {
|
|
629
|
+
${!readOnly && `
|
|
630
|
+
&::after {
|
|
631
|
+
border-bottom-color: ${lineFocus};
|
|
632
|
+
transform: scaleX(1);
|
|
633
|
+
}
|
|
634
|
+
`}
|
|
635
|
+
}
|
|
636
|
+
&::before {
|
|
637
|
+
content: '';
|
|
638
|
+
${positionAbsolute};
|
|
639
|
+
left: 0;
|
|
640
|
+
right: 0;
|
|
641
|
+
bottom: 0;
|
|
642
|
+
border-bottom: 1px solid ${lineNormal};
|
|
643
|
+
}
|
|
644
|
+
&::after {
|
|
645
|
+
content: '';
|
|
646
|
+
${positionAbsolute};
|
|
647
|
+
left: 0px;
|
|
648
|
+
right: 0px;
|
|
649
|
+
bottom: -1px;
|
|
650
|
+
border-bottom: 2px solid transparent;
|
|
651
|
+
transform: scaleX(0);
|
|
652
|
+
transform-origin: center;
|
|
653
|
+
transition: all 0.2s ease;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
&.disabled {
|
|
657
|
+
${pointerEventsNone};
|
|
658
|
+
resize: none;
|
|
659
|
+
&.outlined {
|
|
660
|
+
background-color: ${fillDisabled};
|
|
661
|
+
}
|
|
662
|
+
&.underlined::before {
|
|
663
|
+
border-bottom-color: ${fillDisabled} !important;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
& + .DGN-UI-HelperText {
|
|
667
|
+
${positionAbsolute};
|
|
668
|
+
min-height: 16px;
|
|
669
|
+
top: 100%;
|
|
670
|
+
}
|
|
671
|
+
`;
|
|
672
|
+
|
|
673
|
+
const InputBaseIconCSS = css`
|
|
674
|
+
${flexRow};
|
|
675
|
+
color: inherit;
|
|
676
|
+
&.start-icon {
|
|
677
|
+
margin-right: ${spacing([1])};
|
|
678
|
+
& + input {
|
|
679
|
+
padding-left: 0;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
&.end-icon {
|
|
683
|
+
margin-left: ${spacing([1])};
|
|
684
|
+
}
|
|
685
|
+
`;
|
|
665
686
|
InputBase.defaultProps = {
|
|
666
687
|
autoComplete: 'off',
|
|
688
|
+
autoFocus: false,
|
|
667
689
|
className: '',
|
|
668
690
|
defaultValue: '',
|
|
669
|
-
placeholder: getGlobal('inputPlaceholder'),
|
|
670
|
-
resize: 'none',
|
|
671
|
-
status: 'default',
|
|
672
|
-
type: 'text',
|
|
673
|
-
viewType: 'underlined',
|
|
674
|
-
autoFocus: false,
|
|
675
|
-
nonStyle: false,
|
|
676
691
|
disabled: false,
|
|
677
|
-
multiline: false,
|
|
678
|
-
readOnly: false,
|
|
679
|
-
required: false,
|
|
680
692
|
endIconProps: {},
|
|
693
|
+
hoverTooltip: false,
|
|
681
694
|
iconStyle: {},
|
|
682
695
|
inputProps: {},
|
|
683
696
|
inputStyle: {},
|
|
684
|
-
|
|
697
|
+
multiline: false,
|
|
698
|
+
nonStyle: false,
|
|
699
|
+
placeholder: getGlobal('inputPlaceholder'),
|
|
700
|
+
readOnly: false,
|
|
701
|
+
required: false,
|
|
702
|
+
resize: 'none',
|
|
703
|
+
startIconProps: {},
|
|
704
|
+
status: 'default',
|
|
705
|
+
type: 'text',
|
|
706
|
+
viewType: 'underlined'
|
|
685
707
|
};
|
|
686
708
|
InputBase.propTypes = {
|
|
687
709
|
/** the type of border you want to display */
|
|
@@ -726,7 +748,7 @@ InputBase.propTypes = {
|
|
|
726
748
|
/** prevent all event if true */
|
|
727
749
|
readOnly: PropTypes.bool,
|
|
728
750
|
|
|
729
|
-
/**
|
|
751
|
+
/** autofocus after first render */
|
|
730
752
|
autoFocus: PropTypes.bool,
|
|
731
753
|
|
|
732
754
|
/** At least one character is required */
|